Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -N -r1.41.2.3 -r1.41.2.4 --- openacs-4/packages/calendar/calendar.info 25 Sep 2013 10:22:56 -0000 1.41.2.3 +++ openacs-4/packages/calendar/calendar.info 3 Oct 2013 07:39:45 -0000 1.41.2.4 @@ -7,7 +7,7 @@ f f - + Dirk Gomez Personal and shared event calendars. 2013-09-08 @@ -17,7 +17,7 @@ 2 #calendar.Calendar# - + Index: openacs-4/packages/calendar/tcl/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.tcl,v diff -u -N -r1.25 -r1.25.4.1 --- openacs-4/packages/calendar/tcl/cal-item-procs.tcl 26 Feb 2009 02:12:15 -0000 1.25 +++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 3 Oct 2013 07:39:45 -0000 1.25.4.1 @@ -23,7 +23,7 @@ } { set dates_valid_p [db_string dates_valid_p_select {}] - if {[string equal $dates_valid_p 1]} { + if {$dates_valid_p eq "1"} { return 1 } else { return 0 @@ -127,7 +127,7 @@ set row(start_date) [lc_time_fmt $row(start_date_ansi) "%Y-%m-%d"] set row(end_date) [lc_time_fmt $row(end_date_ansi) "%Y-%m-%d"] - set row(day_of_week) [expr [lc_time_fmt $row(start_date_ansi) "%w"] + 1] + set row(day_of_week) [expr {[lc_time_fmt $row(start_date_ansi) "%w"] + 1}] set row(pretty_day_of_week) [lc_time_fmt $row(start_date_ansi) "%A"] set row(day_of_month) [lc_time_fmt $row(start_date_ansi) "%d"] set row(pretty_short_start_date) [lc_time_fmt $row(start_date_ansi) "%x"] @@ -178,7 +178,7 @@ set recurrence_id [db_string select_recurrence_id {}] # If the recurrence id is NULL, then we stop here and just do the normal update - if {![empty_string_p $recurrence_id]} { + if {$recurrence_id ne ""} { calendar::item::edit_recurrence \ -event_id $cal_item_id \ -start_date $start_date \ @@ -216,7 +216,7 @@ # Update the item_type_id and calendar_id set colspecs [list] lappend colspecs "item_type_id = :item_type_id" - if { ![empty_string_p $calendar_id] } { + if { $calendar_id ne "" } { lappend colspecs "on_which_calendar = :calendar_id" db_dml update_context_id { @@ -256,12 +256,12 @@ update the permission of the specific cal_item if revoke is set to revoke, then we revoke all permissions } { - if { ![string equal $revoke "revoke"] } { - if { ![string equal $permission "cal_item_read"] } { + if { $revoke ne "revoke" } { + if { $permission ne "cal_item_read" } { permission::grant -object_id $cal_item_id -party_id $party_id -privilege cal_item_read } permission::grant -object_id $cal_item_id -party_id $party_id -privilege $permission - } elseif { [string equal $revoke "revoke"] } { + } elseif {$revoke eq "revoke"} { permission::revoke -object_id $cal_item_id -party_id $party_id -privilege $permission } @@ -309,7 +309,7 @@ } set colspecs [list] lappend colspecs {item_type_id = :item_type_id} - if { ![empty_string_p $calendar_id] } { + if { $calendar_id ne "" } { lappend colspecs {on_which_calendar = :calendar_id} db_dml update_context_id { Index: openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl,v diff -u -N -r1.6 -r1.6.8.1 --- openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl 8 Aug 2006 21:26:17 -0000 1.6 +++ openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl 3 Oct 2013 07:39:45 -0000 1.6.8.1 @@ -15,7 +15,7 @@ set return_msg [list $msg] set cals [db_list get_calendars {*SQL*} ] - if { [empty_string_p $cals ] } { + if { $cals eq "" } { lappend return_msg "none" } else { lappend return_msg $cals Index: openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl,v diff -u -N -r1.15 -r1.15.12.1 --- openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl 12 Jul 2004 14:49:55 -0000 1.15 +++ openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl 3 Oct 2013 07:39:45 -0000 1.15.12.1 @@ -41,7 +41,7 @@ # we need to have the hour equal gmt at the same time as the client # i.e. if its noon gmt, then its 4am in pst # - if ![empty_string_p $dash] { + if {$dash ne ""} { set date_time_math "- $hours/24" } else { set date_time_math "+ $hours/24" @@ -76,7 +76,7 @@ set ics_event "BEGIN:VCALENDAR\r\nPRODID:-//OpenACS//OpenACS 5.0 MIMEDIR//EN\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:$DTSTART\r\nDTEND:$DTEND\r\n" # Recurrence stuff - if {![empty_string_p $cal_item(recurrence_id)] && $all_occurences_p} { + if {$cal_item(recurrence_id) ne "" && $all_occurences_p} { set recur_rule "RRULE:FREQ=" @@ -91,7 +91,7 @@ year { append recur_rule "YEARLY"} } - if { $recurrence(interval_name) == "week" && ![empty_string_p $recurrence(days_of_week)] } { + if { $recurrence(interval_name) eq "week" && $recurrence(days_of_week) ne "" } { #DRB: Standard indicates ordinal week days are OK, but Outlook #only takes two-letter abbreviation form. @@ -106,11 +106,11 @@ } } - if { ![empty_string_p $recurrence(every_nth_interval)] } { + if { $recurrence(every_nth_interval) ne "" } { append recur_rule ";INTERVAL=$recurrence(every_nth_interval)" } - if { ![empty_string_p $recurrence(recur_until)] } { + if { $recurrence(recur_until) ne "" } { #DRB: this should work with a DATE: type but doesn't with Outlook at least. append recur_rule ";UNTIL=$recurrence(recur_until)" append recur_rule "T000000Z" Index: openacs-4/packages/calendar/tcl/calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-procs.tcl,v diff -u -N -r1.32 -r1.32.4.1 --- openacs-4/packages/calendar/tcl/calendar-procs.tcl 30 Aug 2008 19:51:23 -0000 1.32 +++ openacs-4/packages/calendar/tcl/calendar-procs.tcl 3 Oct 2013 07:39:45 -0000 1.32.4.1 @@ -25,7 +25,7 @@ # MUST CONVERT TO ARRAYS! (ben) array set event_date_arr $event_date - if {![empty_string_p $event_time]} { + if {$event_time ne ""} { array set event_time_arr $event_time } @@ -34,7 +34,7 @@ set day $event_date_arr(day) set month $event_date_arr(month) - if {![empty_string_p $event_time]} { + if {$event_time ne ""} { # extract from event_time set hours $event_time_arr(hours) set minutes $event_time_arr(minutes) @@ -67,7 +67,7 @@ set day "0$day" } - if {[empty_string_p $event_time]} { + if {$event_time eq ""} { return "$year-$month-$day" } else { return "$year-$month-$day $hours:$minutes" @@ -133,18 +133,18 @@ # if the permission is public, oassign the magic object # and set permission to read - if { [string equal $cal_privilege "public"] } { + if {$cal_privilege eq "public"} { set party_id [acs_magic_object "the_public"] set cal_privilege "calendar_read" - } elseif { [string equal $cal_privilege "private"] } { + } elseif {$cal_privilege eq "private"} { set cal_privilege "calendar_read" } - if { [empty_string_p $revoke] } { + if { $revoke eq "" } { # grant the permissions permission::grant -object_id $calendar_id -party_id $party_id -privilege $cal_privilege - } elseif { [string equal $revoke "revoke"] } { + } elseif {$revoke eq "revoke"} { # revoke the permissions permission::revoke -object_id $calendar_id -party_id $party_id -privilege $cal_privilege } @@ -172,9 +172,9 @@ set result [db_string get_calendar_info {} -default 0] } - if { ![string equal $result "0"] } { + if { $result ne "0" } { - if { [string equal $return_id "1"] } { + if {$return_id eq "1"} { return $result } else { return 1 @@ -203,15 +203,15 @@ @creation-date 20-July-2003 } { set first_day_of_week [lc_get firstdayofweek] - set last_day_of_week [expr [expr $first_day_of_week + 6] % 7] + set last_day_of_week [expr {[expr {$first_day_of_week + 6}] % 7}] if {$current_day == $today_julian_date} { set today_p t } else { set today_p f } - set day_number [expr $current_day - $first_julian_date_of_month +1] - set weekday [expr [expr $current_day % 7] + 1] + set day_number [expr {$current_day - $first_julian_date_of_month +1}] + set weekday [expr {[expr {$current_day % 7}] + 1}] set weekday [ad_decode $weekday 7 0 $weekday] set beginning_of_week_p f @@ -312,16 +312,16 @@ {-privilege ""} } { # If no user_id - if {[empty_string_p $user_id]} { + if {$user_id eq ""} { set user_id [ad_conn user_id] } - if {[empty_string_p $package_id]} { + if {$package_id eq ""} { set package_id [ad_conn package_id] } set permissions_clause {} - if { ![empty_string_p $privilege] } { + if { $privilege ne "" } { set permissions_clause [db_map permissions_clause] } @@ -332,8 +332,8 @@ {-date ""} {-julian_date ""} } { - if {[empty_string_p $date]} { - if {![empty_string_p $julian_date]} { + if {$date eq ""} { + if {$julian_date ne ""} { set date [dt_julian_to_ansi $julian_date] } else { set date [dt_sysdate] @@ -349,7 +349,7 @@ {-calendar_name:required} {-package_id ""} } { - if { [empty_string_p $package_id] } { + if { $package_id eq "" } { set package_id [ad_conn package_id] } set extra_vars [ns_set create] @@ -369,7 +369,7 @@ @param user_id The user whose calendar you want to check } { - if { [empty_string_p $user_id] } { + if { $user_id eq "" } { set user_id [ad_conn user_id] } calendar::get -calendar_id $calendar_id -array calendar @@ -415,7 +415,7 @@ } { creates a new item type } { - if {[empty_string_p $item_type_id]} { + if {$item_type_id eq ""} { set item_type_id [db_nextval cal_item_type_seq] } @@ -495,7 +495,7 @@ append new_content "[_ calendar.Start_Time]: $cal_item(start_date_ansi) $cal_item(start_time)
\n" append new_content "[_ calendar.to]: $cal_item(end_date_ansi) $cal_item(end_time)
\n" - if {![empty_string_p $repeat_p] && $repeat_p} { + if {$repeat_p ne "" && $repeat_p} { append new_content "[_ calendar.is_recurring]" } Index: openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl,v diff -u -N -r1.2 -r1.2.8.1 --- openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl 16 Aug 2006 17:52:14 -0000 1.2 +++ openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl 3 Oct 2013 07:39:45 -0000 1.2.8.1 @@ -21,10 +21,10 @@ # build a text content foreach key {description pretty_day_of_week start_time end_time full_start_date start_date_ansi} { - if {[string eq $key start_time]} { + if {$key eq "start_time"} { append content "from " } - if {[string eq $key end_time]} { + if {$key eq "end_time"} { append content "to " } append content "$row($key) " Index: openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl,v diff -u -N -r1.2 -r1.2.6.1 --- openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 15 May 2007 20:14:21 -0000 1.2 +++ openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 3 Oct 2013 07:39:45 -0000 1.2.6.1 @@ -48,10 +48,10 @@ set recurrence_event_ids [db_list q "select cal_item_id as cal_item_id from acs_events, cal_items where cal_item_id=event_id and recurrence_id=:recurrence_id" ] foreach event_id $recurrence_event_ids { calendar::item::get -cal_item_id $event_id -array cal_item - set passed [expr {$passed && [string equal $ci_name $cal_item(name)]}] + set passed [expr {$passed && $ci_name eq $cal_item(name)}] # for some reason the description is not set - set passed [expr {$passed && [string equal $ci_description $cal_item(description)]}] + set passed [expr {$passed && $ci_description eq $cal_item(description)}] lappend recurrence_event_ids $event_id } aa_true "Name correct on all recurrences" $passed @@ -72,9 +72,9 @@ foreach event_id $recurrence_event_ids { calendar::item::get -cal_item_id $event_id -array cal_item - set passed [expr {$passed && [string equal $ci_name $cal_item(name)]}] + set passed [expr {$passed && $ci_name eq $cal_item(name)}] # for some reason the description is not set - set passed [expr {$passed && [string equal $ci_description $cal_item(description)]}] + set passed [expr {$passed && $ci_description eq $cal_item(description)}] } aa_true "Name correct on all recurrences 2" $passed @@ -94,9 +94,9 @@ foreach event_id $recurrence_event_ids { calendar::item::get -cal_item_id $event_id -array cal_item - set passed [expr {$passed && [string equal $new_names($event_id) $cal_item(name)]}] + set passed [expr {$passed && $new_names($event_id) eq $cal_item(name)}] # for some reason the description is not set - set passed [expr {$passed && [string equal $ci_description $cal_item(description)]}] + set passed [expr {$passed && $ci_description eq $cal_item(description)}] } aa_true "New individual names are correct" $passed @@ -113,8 +113,8 @@ set passed 1 foreach event_id $recurrence_event_ids { calendar::item::get -cal_item_id $event_id -array cal_item - set passed [expr {$passed && [string equal $new_names($event_id) $cal_item(name)]}] - set passed [expr {$passed && [string equal $ci_description $cal_item(description)]}] + set passed [expr {$passed && $new_names($event_id) eq $cal_item(name)}] + set passed [expr {$passed && $ci_description eq $cal_item(description)}] } aa_true "Edited item and New individual names are correct" $passed @@ -129,8 +129,8 @@ set passed 1 foreach event_id $recurrence_event_ids { calendar::item::get -cal_item_id $event_id -array cal_item - set passed [expr {$passed && [string equal "New Name" $cal_item(name)]}] - set passed [expr {$passed && [string equal $ci_description $cal_item(description)]}] + set passed [expr {$passed && "New Name" eq $cal_item(name)}] + set passed [expr {$passed && $ci_description eq $cal_item(description)}] } aa_true "Edited item name and New individual names are updated" $passed Index: openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl,v diff -u -N -r1.8.4.1 -r1.8.4.2 --- openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl 7 Sep 2013 09:30:37 -0000 1.8.4.1 +++ openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl 3 Oct 2013 07:39:45 -0000 1.8.4.2 @@ -21,8 +21,12 @@ calendar::item::get -cal_item_id $cal_item_id -array cal_item set dow_string "" -foreach dow [list [list "#calendar.Sunday#" 0] [list "#calendar.Monday#" 1] [list "#calendar.Tuesday#" 2] [list "#calendar.Wednesday#" 3] [list "#calendar.Thursday#" 4] [list "#calendar.Friday#" 5] [list "#calendar.Saturday#" 6]] { - if {[lindex $dow 1] == [expr "$cal_item(day_of_week) -1"]} { +foreach dow { + {"#calendar.Sunday#" 0} {"#calendar.Monday#" 1} {"#calendar.Tuesday#" 2} + {"#calendar.Wednesday#" 3} {"#calendar.Thursday#" 4} {"#calendar.Friday#" 5} + {"#calendar.Saturday#" 6} +} { + if {[lindex $dow 1] == $cal_item(day_of_week) - 1} { set checked_html "CHECKED" } else { set checked_html "" Index: openacs-4/packages/calendar/www/cal-item-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.tcl,v diff -u -N -r1.38 -r1.38.4.1 --- openacs-4/packages/calendar/www/cal-item-new.tcl 8 Sep 2008 20:13:37 -0000 1.38 +++ openacs-4/packages/calendar/www/cal-item-new.tcl 3 Oct 2013 07:39:45 -0000 1.38.4.1 @@ -47,7 +47,7 @@ set calendar_id [lindex [lindex $calendar_options 0] 1] } # TODO: Move into ad_form -if { [exists_and_not_null cal_item_id] } { +if { ([info exists cal_item_id] && $cal_item_id ne "") } { set page_title [_ calendar.Calendar_Edit_Item] set ad_form_mode display } else { @@ -121,7 +121,7 @@ multirow create time_format_elms name -while { ![empty_string_p $format_string] } { +while { $format_string ne "" } { # Snip off the next token regexp {([^/\-.: ]*)([/\-.: ]*)(.*)} \ $format_string match word sep format_string @@ -174,11 +174,11 @@ set date [calendar::from_sql_datetime -sql_date $ansi_date -format "YYY-MM-DD"] set repeat_p 0 - if {[info exists start_time] && ![empty_string_p $start_time] && $start_time != 0} { + if {[info exists start_time] && $start_time ne "" && $start_time != 0} { # Set the start time set start_hour $start_time set start_time "{} {} {} $start_time 0 {} {HH24:MI}" - set end_time "{} {} {} [expr $start_hour + 1] 0 {} {HH24:MI}" + set end_time "{} {} {} [expr {$start_hour + 1}] 0 {} {HH24:MI}" set time_p 1 } else { set time_p 0 @@ -214,7 +214,7 @@ } else { set js "enableTime('cal_item');" } - if { [empty_string_p $repeat_p] } { + if { $repeat_p eq "" } { set repeat_p 0 } else { set repeat_p 1 @@ -263,7 +263,7 @@ if {$repeat_p} { ad_returnredirect [export_vars -base cal-item-create-recurrence { return_url cal_item_id}] } else { - if { [string compare $return_url "./"] } { + if {$return_url ne "./" } { ad_returnredirect $return_url } else { ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] @@ -320,7 +320,7 @@ -edit_past_events_p $edit_past_events_p \ -calendar_id $calendar_id - if { [string compare $return_url "./"] } { + if {$return_url ne "./" } { ad_returnredirect $return_url } else { ad_returnredirect [export_vars -base cal-item-view { cal_item_id }] Index: openacs-4/packages/calendar/www/calendar-item-types.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/calendar-item-types.tcl,v diff -u -N -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/calendar/www/calendar-item-types.tcl 7 Sep 2013 09:30:37 -0000 1.5.2.1 +++ openacs-4/packages/calendar/www/calendar-item-types.tcl 3 Oct 2013 07:39:46 -0000 1.5.2.2 @@ -51,7 +51,7 @@ foreach item_type $item_types { set item_type_id [lindex $item_type 1] set type [lindex $item_type 0] - if {[empty_string_p $item_type_id]} { + if {$item_type_id eq ""} { continue } multirow append item_types "$type" "[_ acs-kernel.common_Delete]" [export_vars -base "item-type-delete" {calendar_id item_type_id}] Index: openacs-4/packages/calendar/www/mini-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/mini-calendar.tcl,v diff -u -N -r1.20.2.4 -r1.20.2.5 --- openacs-4/packages/calendar/www/mini-calendar.tcl 9 Sep 2013 16:44:26 -0000 1.20.2.4 +++ openacs-4/packages/calendar/www/mini-calendar.tcl 3 Oct 2013 07:39:46 -0000 1.20.2.5 @@ -1,8 +1,8 @@ -if {![exists_and_not_null base_url]} { +if {(![info exists base_url] || $base_url eq "")} { set base_url [ad_conn url] } -if {![exists_and_not_null date]} { +if {(![info exists date] || $date eq "")} { set date [dt_sysdate] } @@ -20,7 +20,7 @@ } -on_submit {} -if {[exists_and_not_null page_num]} { +if {([info exists page_num] && $page_num ne "")} { set page_num_formvar [export_vars -form {page_num}] set page_num "&page_num=$page_num" } else { @@ -29,8 +29,10 @@ } # Determine whether we need to pass on the period_days variable from the list view -if {[string equal $view list]} { - if {![exists_and_not_null period_days] || [string equal $period_days [parameter::get -parameter ListView_DefaultPeriodDays -default 31]]} { +if {$view eq "list"} { + if {(![info exists period_days] || $period_days eq "") + || $period_days eq [parameter::get -parameter ListView_DefaultPeriodDays -default 31] + } { set url_stub_period_days "" } else { set url_stub_period_days "&period_days=${period_days}" @@ -49,12 +51,12 @@ # Create row with existing views multirow create views name text active_p url foreach viewname {list day week month} { - if { [string equal $viewname $view] } { + if {$viewname eq $view} { set active_p t } else { set active_p f } - if {[string equal $viewname list]} { + if {$viewname eq "list"} { multirow append views [lang::util::localize $message_key_array($viewname)] $viewname $active_p \ "[export_vars -base $base_url {date {view $viewname}}]${page_num}${url_stub_period_days}" } else { @@ -88,7 +90,7 @@ set today [lc_time_fmt [dt_sysdate] "%q"] -if [string equal $view month] { +if {$view eq "month"} { set prev_year [clock format [clock scan "1 year ago" -base $now] -format "%Y-%m-%d"] set next_year [clock format [clock scan "1 year" -base $now] -format "%Y-%m-%d"] set prev_year_url "$base_url?view=$view&date=[ad_urlencode $prev_year]${page_num}${url_stub_period_days}" @@ -104,8 +106,8 @@ # show 3 months in a row - set new_row_p [expr $i / 3] -# if {($i != 0) && ([expr $i % 3] == 0)} { + set new_row_p [expr {$i / 3}] +# if {($i != 0) && ($i % 3 == 0)} { # set new_row_p t # } else { # set new_row_p f @@ -117,7 +119,7 @@ set current_month_p f } set target_date [clock format \ - [clock scan "[expr $i-$curr_month_idx] month" -base $now] -format "%Y-%m-%d"] + [clock scan "[expr {$i-$curr_month_idx}] month" -base $now] -format "%Y-%m-%d"] multirow append months $month $current_month_p $new_row_p \ "[export_vars -base $base_url {{date $target_date} view}]${page_num}${url_stub_period_days}" @@ -134,7 +136,7 @@ multirow create days_of_week day_short day_num for {set i 0} {$i < 7} {incr i} { multirow append days_of_week \ - [lindex $week_days [expr [expr $i + $first_day_of_week] % 7]] \ + [lindex $week_days [expr {[expr {$i + $first_day_of_week}] % 7}]] \ $i } @@ -143,14 +145,14 @@ set day_of_week 1 # Calculate number of active days - set active_days_before_month [expr [expr [dt_first_day_of_month $year $month]] -1 ] - set active_days_before_month [expr [expr $active_days_before_month + 7 - $first_day_of_week] % 7] + set active_days_before_month [expr {[dt_first_day_of_month $year $month] - 1} ] + set active_days_before_month [expr {($active_days_before_month + 7 - $first_day_of_week) % 7}] - set calendar_starts_with_julian_date [expr $first_julian_date_of_month - $active_days_before_month] - set day_number [expr $days_in_last_month - $active_days_before_month + 1] + set calendar_starts_with_julian_date [expr {$first_julian_date_of_month - $active_days_before_month}] + set day_number [expr {$days_in_last_month - $active_days_before_month + 1}] - for {set julian_date $calendar_starts_with_julian_date} {$julian_date <= [expr $last_julian_date + 7]} {incr julian_date} { - if {$julian_date > $last_julian_date_in_month && [string equal $end_of_week_p t] } { + for {set julian_date $calendar_starts_with_julian_date} {$julian_date <= $last_julian_date + 7} {incr julian_date} { + if {$julian_date > $last_julian_date_in_month && $end_of_week_p eq "t" } { break } set today_p f @@ -166,7 +168,7 @@ if {$julian_date == $first_julian_date_of_month} { set day_number 1 - } elseif {$julian_date == [expr $last_julian_date_in_month +1]} { + } elseif {$julian_date == $last_julian_date_in_month + 1} { set day_number 1 } @@ -203,7 +205,7 @@ set today_url "$base_url?view=day&date=[ad_urlencode [dt_sysdate]]${page_num}${url_stub_period_days}" -if { $view == "day" && [dt_sysdate] == $date } { +if { $view eq "day" && [dt_sysdate] == $date } { set today_p t } else { set today_p f Index: openacs-4/packages/calendar/www/navbar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/navbar.tcl,v diff -u -N -r1.4 -r1.4.4.1 --- openacs-4/packages/calendar/www/navbar.tcl 9 Nov 2008 23:29:22 -0000 1.4 +++ openacs-4/packages/calendar/www/navbar.tcl 3 Oct 2013 07:39:46 -0000 1.4.4.1 @@ -1,34 +1,34 @@ #expects: view -if {![exists_and_not_null base_url]} { +if {(![info exists base_url] || $base_url eq "")} { set base_url [ad_conn url] } -if {![exists_and_not_null date]} { +if {(![info exists date] || $date eq "")} { set date [dt_sysdate] } -if {[exists_and_not_null page_num]} { +if {([info exists page_num] && $page_num ne "")} { set page_num "&page_num=$page_num" } else { set page_num "" } -if {![exists_and_not_null period_days] || [string equal $period_days [parameter::get -parameter ListView_DefaultPeriodDays -default 31]]} { +if {(![info exists period_days] || $period_days eq "") || $period_days eq [parameter::get -parameter ListView_DefaultPeriodDays -default 31]} { set url_stub_period_days "" } else { set url_stub_period_days "&period_days=${period_days}" } foreach test_view {list day week month calendar} { - if { [string equal $test_view $view] } { + if {$test_view eq $view} { set ${test_view}_selected_p t } else { set ${test_view}_selected_p f } } -if { [string match /dotlrn* $base_url] } { +if { [string match "/dotlrn*" $base_url] } { set link "[export_vars -url -base $base_url -entire_form -exclude {export}]&export=print" } else { set link "[export_vars -base $base_url {date {view day}}]&export=print" Index: openacs-4/packages/calendar/www/view-list-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-list-display.tcl,v diff -u -N -r1.33 -r1.33.4.1 --- openacs-4/packages/calendar/www/view-list-display.tcl 16 Jul 2009 11:31:56 -0000 1.33 +++ openacs-4/packages/calendar/www/view-list-display.tcl 3 Oct 2013 07:39:46 -0000 1.33.4.1 @@ -11,25 +11,25 @@ if { ![info exists show_calendar_name_p] } { set show_calendar_name_p 1 } -if { ![exists_and_not_null sort_by] } { +if { (![info exists sort_by] || $sort_by eq "") } { set sort_by "start_date" } -if { ![exists_and_not_null start_date] } { +if { (![info exists start_date] || $start_date eq "") } { set start_date [clock format [clock seconds] -format "%Y-%m-%d 00:00"] } -if { ![exists_and_not_null end_date] } { +if { (![info exists end_date] || $end_date eq "") } { set end_date [clock format [clock scan "+30 days" -base [clock scan $start_date]] -format "%Y-%m-%d 00:00"] } -if {[exists_and_not_null calendar_id_list]} { +if {([info exists calendar_id_list] && $calendar_id_list ne "")} { set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] } else { set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] } -#if { ![exists_and_not_null period_days] } { +#if { (![info exists period_days] || $period_days eq "") } { # set period_days [parameter::get -parameter ListView_DefaultPeriodDays -default 31] #} else { # set end_date [clock format [clock scan "+${period_days} days" -base [clock scan $start_date]] -format "%Y-%m-%d 00:00"] @@ -40,19 +40,19 @@ set user_id [ad_conn user_id] # The title -if {[empty_string_p $start_date] && [empty_string_p $end_date]} { +if {$start_date eq "" && $end_date eq ""} { set title "" } -if {[empty_string_p $start_date] && ![empty_string_p $end_date]} { +if {$start_date eq "" && $end_date ne ""} { set title "[_ acs-datetime.to] [lc_time_fmt $end_date "%q"]" } -if {![empty_string_p $start_date] && [empty_string_p $end_date]} { +if {$start_date ne "" && $end_date eq ""} { set title "[_ acs-datetime.Items_from] [lc_time_fmt $start_date "%q"]" } -if {![empty_string_p $start_date] && ![empty_string_p $end_date]} { +if {$start_date ne "" && $end_date ne ""} { set title "[_ acs-datetime.Items_from] [lc_time_fmt $start_date "%q"] [_ acs-datetime.to] [lc_time_fmt $end_date "%q"]" } @@ -84,7 +84,7 @@ set interval_limitation_clause [db_map dbqd.calendar.www.views.list_interval_limitation] set order_by_clause " order by $sort_by" set additional_limitations_clause "" -if { [exists_and_not_null cal_system_type] } { +if { ([info exists cal_system_type] && $cal_system_type ne "") } { append additional_limitations_clause " and system_type = :cal_system_type " } @@ -118,15 +118,15 @@ set pretty_end_time "--" } - if {[string equal $pretty_start_time "00:00"]} { + if {$pretty_start_time eq "00:00"} { set pretty_start_time "--" } - if {[string equal $pretty_end_time "00:00"]} { + if {$pretty_end_time eq "00:00"} { set pretty_end_time "--" } - if {![string equal $pretty_start_date $last_pretty_start_date]} { + if {$pretty_start_date ne $last_pretty_start_date } { set last_pretty_start_date $pretty_start_date } @@ -205,7 +205,7 @@ set period_url_$i "[export_vars -base $self_url -url -entire_form {{period_days $i}}]\#calendar" } -if { [info exists export] && [string equal $export print] } { +if { [info exists export] && $export eq "print" } { set print_html [template::adp_parse [acs_root_dir]/packages/calendar/www/view-print-display [list &items items show_calendar_name_p $show_calendar_name_p]] ns_return 200 text/html $print_html ad_script_abort @@ -216,7 +216,7 @@ set the_form [ns_getform] - if { ![empty_string_p $the_form] } { + if { $the_form ne "" } { for { set i 0 } { $i < [ns_set size $the_form] } { incr i } { set varname [ns_set key $the_form $i] set varvalue [ns_set value $the_form $i] Index: openacs-4/packages/calendar/www/view-month-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-month-display.tcl,v diff -u -N -r1.25 -r1.25.4.1 --- openacs-4/packages/calendar/www/view-month-display.tcl 9 Nov 2008 23:29:22 -0000 1.25 +++ openacs-4/packages/calendar/www/view-month-display.tcl 3 Oct 2013 07:39:46 -0000 1.25.4.1 @@ -1,13 +1,13 @@ set system_type "" -if {![info exists date] || [empty_string_p $date]} { +if {![info exists date] || $date eq ""} { # Default to todays date in the users (the connection) timezone set server_now_time [dt_systime] set user_now_time [lc_time_system_to_conn $server_now_time] set date [lc_time_fmt $user_now_time "%x"] } -if { [exists_and_not_null export] } { +if { ([info exists export] && $export ne "") } { set exporting_p 1 } else { set exporting_p 0 @@ -23,7 +23,7 @@ set show_calendar_name_p 1 } -if {[exists_and_not_null calendar_id_list]} { +if {([info exists calendar_id_list] && $calendar_id_list ne "")} { set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] } else { set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] @@ -34,7 +34,7 @@ set this_month [dt_trim_leading_zeros [lindex $date_list 1]] set this_day [dt_trim_leading_zeros [lindex $date_list 2]] -set month_string [lindex [dt_month_names] [expr $this_month - 1]] +set month_string [lindex [dt_month_names] $this_month-1] set package_id [ad_conn package_id] set user_id [ad_conn user_id] @@ -44,7 +44,7 @@ set next_month_url ?[export_vars {{view month} {date $next_month} page_num}] set first_day_of_week [lc_get firstdayofweek] -set last_day_of_week [expr [expr $first_day_of_week + 6] % 7] +set last_day_of_week [expr {[expr {$first_day_of_week + 6}] % 7}] set week_days [lc_get day] multirow create weekday_names weekday_num weekday_long @@ -93,7 +93,7 @@ # Calculate number of greyed days and then add them to the calendar mulitrow set greyed_days_before_month [expr [expr [dt_first_day_of_month $this_year $this_month]] -1 ] -set greyed_days_before_month [expr [expr $greyed_days_before_month + 7 - $first_day_of_week] % 7] +set greyed_days_before_month [expr {[expr {$greyed_days_before_month + 7 - $first_day_of_week}] % 7}] if { !$exporting_p } { @@ -216,7 +216,7 @@ $display_information(today_p) \ f \ $time_p \ - [export_vars -base ${calendar_url}cal-item-new {{date $current_day_ansi} {start_time ""} {end_time ""}}]" \ + [export_vars -base ${calendar_url}cal-item-new {{date $current_day_ansi} {start_time ""} {end_time ""}}] \ ?[export_vars {{view day} {date $current_day_ansi} page_num}] \ "calendar-${system_type}Item" \ $num_attachments \ @@ -262,10 +262,10 @@ } # Add cells for remaining days outside the month - set remaining_days [expr [expr $first_day_of_week + 6 - $current_day % 7] % 7] + set remaining_days [expr {[expr {$first_day_of_week + 6 - $current_day % 7}] % 7}] if {$remaining_days > 0} { - for {} {$current_day <= [expr $last_julian_date_in_month + $remaining_days]} {incr current_day} { + for {} {$current_day <= $last_julian_date_in_month + $remaining_days} {incr current_day} { multirow append items \ "" \ "" \ @@ -292,7 +292,7 @@ } } -if { [info exists export] && [string equal $export print] } { +if { [info exists export] && $export eq "print" } { set print_html [template::adp_parse [acs_root_dir]/packages/calendar/www/view-print-display [list &items items show_calendar_name_p $show_calendar_name_p]] ns_return 200 text/html $print_html ad_script_abort Index: openacs-4/packages/calendar/www/view-one-day-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-one-day-display.tcl,v diff -u -N -r1.40 -r1.40.2.1 --- openacs-4/packages/calendar/www/view-one-day-display.tcl 10 Oct 2009 22:38:09 -0000 1.40 +++ openacs-4/packages/calendar/www/view-one-day-display.tcl 3 Oct 2013 07:39:46 -0000 1.40.2.1 @@ -33,13 +33,13 @@ set end_display_hour 23 } -if {[exists_and_not_null calendar_id_list]} { +if {([info exists calendar_id_list] && $calendar_id_list ne "")} { set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] } else { set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] } -if {[empty_string_p $date]} { +if {$date eq ""} { # Default to todays date in the users (the connection) timezone set server_now_time [dt_systime] set user_now_time [lc_time_system_to_conn $server_now_time] @@ -72,7 +72,7 @@ # Loop through the items without time set additional_limitations_clause " and to_char(start_date, 'HH24:MI') = to_char(end_date, 'HH24:MI')" -if { [exists_and_not_null cal_system_type] } { +if { ([info exists cal_system_type] && $cal_system_type ne "") } { append additional_limitations_clause " and system_type = :cal_system_type " } set additional_select_clause "" @@ -114,7 +114,7 @@ } set additional_limitations_clause " and to_char(start_date, 'HH24:MI') <> to_char(end_date, 'HH24:MI')" -if { [exists_and_not_null cal_system_type] } { +if { ([info exists cal_system_type] && $cal_system_type ne "") } { append additional_limitations_clause " and system_type = :cal_system_type " } set order_by_clause " order by to_char(start_date,'HH24:MI')" @@ -159,7 +159,7 @@ + ($start_minutes*$hour_height_inside/60)] set bottom [expr ($end_hour * ($hour_height_inside+$hour_height_sep)) \ + ($end_minutes*$hour_height_inside/60)] - set height [expr $bottom - $top - 2] + set height [expr {$bottom - $top - 2}] set bump_right $bump_right_base foreach {previous_start previous_end} $previous_intervals { @@ -197,7 +197,7 @@ } else { set currval [multirow get items $i top] multirow set items $i top \ - [expr $currval - ($adjusted_start_display_hour*($hour_height_inside+$hour_height_sep))] + [expr {$currval - ($adjusted_start_display_hour*($hour_height_inside+$hour_height_sep))}] } } @@ -225,7 +225,7 @@ [export_vars -base ${calendar_url}cal-item-new {{date $current_date} {start_time $grid_hour}}] } -if { [info exists export] && [string equal $export print] } { +if { [info exists export] && $export eq "print" } { set print_html [template::adp_parse [acs_root_dir]/packages/calendar/www/view-print-display [list &items items show_calendar_name_p $show_calendar_name_p]] ns_return 200 text/html $print_html ad_script_abort Index: openacs-4/packages/calendar/www/view-week-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-week-display.tcl,v diff -u -N -r1.25 -r1.25.2.1 --- openacs-4/packages/calendar/www/view-week-display.tcl 10 Oct 2009 22:38:09 -0000 1.25 +++ openacs-4/packages/calendar/www/view-week-display.tcl 3 Oct 2013 07:39:46 -0000 1.25.2.1 @@ -29,13 +29,13 @@ set show_calendar_name_p 1 } -if {[exists_and_not_null calendar_id_list]} { +if {([info exists calendar_id_list] && $calendar_id_list ne "")} { set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] } else { set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] } -if {[empty_string_p $date]} { +if {$date eq ""} { # Default to todays date in the users (the connection) timezone set server_now_time [dt_systime] set user_now_time [lc_time_system_to_conn $server_now_time] @@ -52,7 +52,7 @@ set first_day_of_week [lc_get firstdayofweek] set first_us_weekday [lindex [lc_get -locale en_US day] $first_day_of_week] -set last_us_weekday [lindex [lc_get -locale en_US day] [expr [expr $first_day_of_week + 6] % 7]] +set last_us_weekday [lindex [lc_get -locale en_US day] [expr {[expr {$first_day_of_week + 6}] % 7}]] db_1row select_weekday_info {} db_1row select_week_info {} @@ -89,7 +89,7 @@ set interval_limitation_clause [db_map dbqd.calendar.www.views.week_interval_limitation] set additional_limitations_clause "" set additional_select_clause [db_map dow] -if { [exists_and_not_null cal_system_type] } { +if { ([info exists cal_system_type] && $cal_system_type ne "") } { append additional_limitations_clause " and system_type = :cal_system_type " } @@ -113,7 +113,7 @@ scan [lc_time_fmt $ansi_start_date "%H"] %d start_hour scan [lc_time_fmt $ansi_end_date "%H"] %d end_hour - set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + set ansi_this_date [dt_julian_to_ansi [expr {$first_weekday_julian + $current_weekday}]] if { $start_time eq $end_time } { set no_time_p t @@ -166,7 +166,7 @@ + ($top_minutes*$hour_height_inside/60)] set bottom [expr ($bottom_hour * ($hour_height_inside+$hour_height_sep)) \ + ($bottom_minutes*$hour_height_inside/60)] - set height [expr $bottom - $top - 3] + set height [expr {$bottom - $top - 3}] set left $event_left_base @@ -192,8 +192,8 @@ set max_bumps $bumps } } - incr top [expr $bumps*5] - incr left [expr $bumps*$event_bump_delta] + incr top [expr {$bumps*5}] + incr left [expr {$bumps*$event_bump_delta}] set event_url [export_vars -base [site_node::get_url_from_object_id -object_id $cal_package_id]cal-item-view {return_url {cal_item_id $item_id}}] @@ -236,15 +236,15 @@ } else { set currval [multirow get items $i top] multirow set items $i top \ - [expr $currval - ($adjusted_start_display_hour*($hour_height_inside+$hour_height_sep))] + [expr {$currval - ($adjusted_start_display_hour*($hour_height_inside+$hour_height_sep))}] } } # Navigation Bar set dates "[lc_time_fmt $first_weekday_date "%q"] - [lc_time_fmt $last_weekday_date "%q"]" -set prev_date_ansi [ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]] +set prev_date_ansi [ad_urlencode [dt_julian_to_ansi [expr {$first_weekday_julian - 7}]]] set previous_week_url ?[export_vars {page_num {view week} {date $prev_date_ansi}}]\#calendar -set next_date_ansi [ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]] +set next_date_ansi [ad_urlencode [dt_julian_to_ansi [expr {$first_weekday_julian + 7}]]] set next_week_url ?[export_vars {page_num {view week} {date $next_date_ansi}}]\#calendar #Calendar grid. @@ -268,15 +268,15 @@ set week_days [lc_get abday] set first_weekday_date_secs [clock scan "-24 hours" -base [clock scan "1 day" -base [clock scan $first_weekday_date]]] -set next_week [clock format [expr $first_weekday_date_secs + (7*86400)] -format "%Y-%m-%d"] -set last_week [clock format [expr $first_weekday_date_secs - (7*86400)] -format "%Y-%m-%d"] +set next_week [clock format [expr {$first_weekday_date_secs + (7*86400)}] -format "%Y-%m-%d"] +set last_week [clock format [expr {$first_weekday_date_secs - (7*86400)}] -format "%Y-%m-%d"] multirow create days_of_week width day_short monthday weekday_date weekday_url day_num set nav_url_base [ad_conn url]?[export_vars -url -entire_form -exclude {date view}] for {set i 0} {$i < 7} {incr i} { - set weekday_secs [expr $first_weekday_date_secs + ($i*86400)] + set weekday_secs [expr {$first_weekday_date_secs + ($i*86400)}] set trimmed_month \ [string trimleft [clock format $weekday_secs -format "%m"] 0] set trimmed_day \ @@ -294,7 +294,7 @@ incr week_width [set day_width_$i] } -if { [info exists export] && [string equal $export print] } { +if { [info exists export] && $export eq "print" } { set print_html [template::adp_parse [acs_root_dir]/packages/calendar/www/view-print-display [list &items items show_calendar_name_p $show_calendar_name_p]] ns_return 200 text/html $print_html ad_script_abort Index: openacs-4/packages/calendar/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.tcl,v diff -u -N -r1.30 -r1.30.4.1 --- openacs-4/packages/calendar/www/view.tcl 10 Jul 2009 12:54:07 -0000 1.30 +++ openacs-4/packages/calendar/www/view.tcl 3 Oct 2013 07:39:46 -0000 1.30.4.1 @@ -14,7 +14,7 @@ {period_days:integer {[parameter::get -parameter ListView_DefaultPeriodDays -default 31]}} } -validate { valid_date -requires { date } { - if {![string equal $date ""]} { + if {$date ne "" } { if {[catch {set date [clock format [clock scan $date] -format "%Y-%m-%d"]} err]} { ad_complain "Your input was not valid. It has to be in the form YYYYMMDD." } @@ -29,7 +29,7 @@ set export [ns_queryget export] -if {$export == "print"} { +if {$export eq "print"} { set view "list" } @@ -42,16 +42,16 @@ set date [calendar::adjust_date -date $date] -if {$view == "list"} { - if {[empty_string_p $start_date]} { +if {$view eq "list"} { + if {$start_date eq ""} { set start_date $date } set ansi_list [split $start_date "- "] set ansi_year [lindex $ansi_list 0] set ansi_month [string trimleft [lindex $ansi_list 1] "0"] set ansi_day [string trimleft [lindex $ansi_list 2] "0"] - set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + $period_days]] + set end_date [dt_julian_to_ansi [expr {[dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + $period_days}]] } if { $user_id eq 0 } { set calendar_personal_p 0 Index: openacs-4/packages/calendar/www/admin/calendar-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/calendar-create.tcl,v diff -u -N -r1.1.1.1 -r1.1.1.1.24.1 --- openacs-4/packages/calendar/www/admin/calendar-create.tcl 23 Apr 2001 23:09:38 -0000 1.1.1.1 +++ openacs-4/packages/calendar/www/admin/calendar-create.tcl 3 Oct 2013 07:39:46 -0000 1.1.1.1.24.1 @@ -30,13 +30,13 @@ # if the permission is private, we would have to wait until # the user selects an audience. -if { [string equal $calendar_permission "public"]} { +if {$calendar_permission eq "public"} { # assign the permission to the calendar calendar_assign_permissions $calendar_id $party_id $calendar_permission ad_returnredirect "one?action=permission&calendar_id=$calendar_id" -} elseif { [string equal $calendar_permission "private"]} { +} elseif {$calendar_permission eq "private"} { # this would be a special case where they'd have to select their audience first ad_returnredirect "one?action=permission&calendar_id=$calendar_id&calendar_permission=private"