Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog-mini-calendar.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.adp 30 Apr 2006 23:53:35 -0000 1.1
+++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.adp 14 Sep 2008 08:59:17 -0000 1.2
@@ -4,11 +4,15 @@
Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog-mini-calendar.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 28 Sep 2007 20:34:07 -0000 1.10
+++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 14 Sep 2008 08:59:17 -0000 1.11
@@ -1,3 +1,12 @@
+#
+# The following time range specifies the dates between the navigation
+# arrows of the weblog mini calendar should be. Without a limitation,
+# crawler will iterate over this pages until they reach infinite past
+# or infinite future.
+#
+set earliest_date "2006-01-1"
+set latest_date "1 year"
+
::xo::Page requireCSS "/resources/calendar/calendar.css"
set package_id [::xo::cc package_id]
set folder_id [$__including_page set parent_id]
@@ -13,12 +22,6 @@
set date [dt_sysdate]
}
-#if {[exists_and_not_null page_num]} {
-# set page_num "&page_num=$page_num"
-#} else {
-# set page_num ""
-#}
-
array set message_key_array {
list #acs-datetime.List#
day #acs-datetime.Day#
@@ -35,21 +38,34 @@
}
set now [clock scan $date]
+set prev_mon [clock scan "1 month ago" -base $now]
+set next_mon [clock scan "1 month" -base $now]
+
+set earliest_date "2008-08-1"
+set latest_date "1 month"
+
set date_list [dt_ansi_to_list $date]
set year [dt_trim_leading_zeros [lindex $date_list 0]]
set month [dt_trim_leading_zeros [lindex $date_list 1]]
set day [dt_trim_leading_zeros [lindex $date_list 2]]
-set months_list [dt_month_names]
-set curr_month_idx [expr {[dt_trim_leading_zeros [clock format $now -format "%m"]]-1}]
+set months_list [dt_month_names]
+set curr_month_idx [expr {[dt_trim_leading_zeros [clock format $now -format "%m"]]-1}]
+set curr_month [lindex $months_list $curr_month_idx ]
-set curr_month [lindex $months_list $curr_month_idx ]
-set prev_month [clock format [clock scan "1 month ago" -base $now] -format "%Y-%m-%d"]
-set next_month [clock format [clock scan "1 month" -base $now] -format "%Y-%m-%d"]
-set prev_month_url [export_vars -base $base_url {{date $prev_month} page_num summary}]
-set next_month_url [export_vars -base $base_url {{date $next_month} page_num summary}]
-#set next_month_url "$base_url?date=[ad_urlencode $next_month]${page_num}"
-
+if {$prev_mon < [clock scan $earliest_date]} {
+ set prev_month_url ""
+} else {
+ set prev_month [clock format $prev_mon -format "%Y-%m-%d"]
+ set prev_month_url [export_vars -base $base_url {{date $prev_month} page_num summary}]
+}
+if {$next_mon > [clock scan $latest_date]} {
+ set next_month_url ""
+} else {
+ set next_month [clock format $next_mon -format "%Y-%m-%d"]
+ set next_month_url [export_vars -base $base_url {{date $next_month} page_num summary}]
+}
+
set first_day_of_week [lc_get firstdayofweek]
set week_days [lc_get abday]
multirow create days_of_week day_short