Index: openacs-4/packages/lorsm/tcl/lorsm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/tcl/lorsm-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/lorsm/tcl/lorsm-procs.tcl 13 Aug 2007 09:20:15 -0000 1.17 +++ openacs-4/packages/lorsm/tcl/lorsm-procs.tcl 3 Sep 2008 19:32:13 -0000 1.18 @@ -137,34 +137,41 @@ } ad_proc -public dates_calc { - -start_date:required - -end_date:required + -start_date + -end_date + -seconds } { Returns the number of minutes, hours or dates given a start - and end date. + and end date or a number of seconds. If seconds is specified + date is ignored. @param start_date Starting date @param end_date Ending date @author Ernie Ghiglione (ErnieG@mm.st) } { - - set start [clock scan "$start_date"] - set end [clock scan "$end_date"] - - set difference [expr {$end - $start}] - + if {[info exists seconds]} { + if {$seconds ne ""} { + set difference $seconds + } else { + return "" + } + } else { + set start [clock scan "$start_date"] + set end [clock scan "$end_date"] + set difference [expr {$end - $start}] + } if {$difference >= 0 && $difference < 60} { return "[_ lorsm.difference_seconds]" } elseif {$difference >= 60 && $difference < 3600} { - set tempval [expr {$difference / 60.0}] + set tempval [expr {$difference / 60}] return "[_ lorsm.tempval_minutes]" } elseif {$difference >= 3600 && $difference < 86400} { - set tempval [expr {$difference / 60.0 /60.0 }] + set tempval [expr {$difference / 3600 }] return "[_ lorsm.tempval_hours]" } else { - set tempval [expr {$difference / 60.0 / 60.0 / 24.0}] + set tempval [expr {$difference / 86400}] return "[_ lorsm.tempval_days]" } } @@ -548,7 +555,7 @@ return } - + ns_log notice "lorsm::get_content item_id $item_id" # Get the live revision set revision_id [db_string get_revision ""] @@ -776,4 +783,4 @@ or empty string if it does not } { return [db_string get_custom_page "select live_revision from cr_items, lorsm_custom_pages where page_id=item_id and man_id=:man_id and type=:type" -default ""] -} \ No newline at end of file +}