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 (defaults to "$item") (optional)
-start_date (optional)
-end_date (optional)
-order_by (optional)
-url_template (defaults to "?order_by=$order_by") (optional)

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
ns_log Notice "Deprecated proc dt_widget_list used:\n[ad_get_tcl_call_stack]"

    # 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: