dt_widget_list (public, deprecated)

 dt_widget_list -calendar_details calendar_details \
    [ -item_template item_template ] [ -start_date start_date ] \
    [ -end_date end_date ] [ -order_by order_by ] \
    [ -url_template url_template ]

Defined in packages/acs-datetime/tcl/acs-calendar-2-procs.tcl

Deprecated. Invoking this procedure generates a warning.

create a listing widget for lists (ben) I would like to ask forgiveness from the coding gods for this proc. Right now this is a big hack to make the schedule look a lot like the SloanSpace v1.0 display. Once we have thought this through a bit more, I will generalize this proc. I promise. Please forgive me. DEPRECATED: time is up Ben. This proc uses hardcoded markup and is therefore difficult to style. It is also not fully localized. Future reimplementations should leverage the templating system more.

Switches:
-calendar_details (required)
-item_template (optional, defaults to "$item")
-start_date (optional)
-end_date (optional)
-order_by (optional)
-url_template (optional, defaults to "?order_by=$order_by")
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_log_deprecated ad_log_deprecated (public) dt_no_time_p dt_no_time_p (public) lc_time_fmt lc_time_fmt (public) util_AnsiDatetoPrettyDate util_AnsiDatetoPrettyDate (public, deprecated) dt_widget_list dt_widget_list dt_widget_list->_ dt_widget_list->ad_log_deprecated dt_widget_list->dt_no_time_p dt_widget_list->lc_time_fmt dt_widget_list->util_AnsiDatetoPrettyDate

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc dt_widget_list
    # Check for zero size
    if {[ns_set size $calendar_details] == 0} {
        return "<i>No Items</i>"
    }

    # The title
    if {$start_date eq "" && $end_date eq ""} {
        #This used to be All Items but that was just taking up space and not adding value so now we assume All Items and only give a title if its something else. - Caroline@meekshome.com
        set title ""
    }

    if {$start_date eq "" && $end_date ne ""} {
        set $pretty_end_date [lc_time_fmt $end_date "%x"]
        set title "[_ acs-datetime.Items_until]"
    }

    if {$start_date ne "" && $end_date eq ""} {
        set title "Items starting [util_AnsiDatetoPrettyDate $start_date]"
    }

    if {$start_date ne "" && $end_date ne ""} {
        set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]"
    }

    set return_html "<b>$title</b><p>"

    # Prepare the templates
    set real_order_by $order_by
    set order_by "item_type"
    set item_type_url [subst $url_template]
    set order_by "start_date"
    set start_date_url [subst $url_template]

    # Create the header
    append return_html [subst {
        <table class="table-display" border="0" cellspacing="0" cellpadding="2">
        <tr class="table-header">
        <th>Day of Week</th>
        <th><a href="[ns_quotehtml $start_date_url]">Date</a></th>
        <th>Start Time</th>
        <th>End Time</th>
    }]

    if {$real_order_by ne "item_type"} {
        append return_html [subst {<th><a href="[ns_quotehtml $item_type_url]">Type</a></th>}]
    }


    append return_html "<th>Title</th></tr>\n"

    # initialize the item_type so we can do intermediate titles
    set old_item_type ""

    set flip 0

    # Loop through the events, and add them
    foreach item [ns_set values $calendar_details] {
        lassign $item date start_time end_time weekday item_type item_details

        # Adjust the display of no-time items
        if {[dt_no_time_p -start_time $start_time -end_time $end_time]} {
            set start_time "--"
            set end_time "--"
        }

        # Do we need a title?
        if {$real_order_by eq "item_type" && $item_type != $old_item_type} {
            if {$item_type eq ""} {
                set item_type_for_title "(No Item Type)"
            } else {
                set item_type_for_title $item_type
            }
            append return_html [subst {<tr class="table-title"><td colspan="5"><b>$item_type_for_title</b></td></tr>}]
            set flip 0
        }

        set old_item_type $item_type

        if {$flip % 2 == 0} {
            set z_class odd
        } else {
            set z_class even
        }

        append return_html "
        <tr class=$z_class><td>$weekday</td><td>$date</td><td>$start_time</td><td>$end_time</td>"

        if {$real_order_by ne "item_type"} {
            append return_html "<td>$item_type</td>"
        }

        append return_html "<td>$item_details</td></tr>\n"
        incr flip
    }

    append return_html "</table>
<!-- End of dt_widget_list --->"

    return $return_html
XQL Not present:
Generic
PostgreSQL XQL file:
packages/acs-datetime/tcl/acs-calendar-2-procs-postgresql.xql

Oracle XQL file:
packages/acs-datetime/tcl/acs-calendar-2-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: