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.9 -r1.10 --- openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl 24 Apr 2018 14:28:56 -0000 1.9 +++ openacs-4/packages/calendar/tcl/calendar-callback-procs.tcl 25 Apr 2018 12:03:28 -0000 1.10 @@ -45,7 +45,7 @@ # each item of the from_user_id list of lists lassign $calendar l_cal_id l_pkg_id - # if the pkg_id of this cal_id is the + # if the pkg_id of this cal_id is # the same for some to_user_id cal # we have to delete it, else we must # change the items from one cal to the other one 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.36 -r1.37 --- openacs-4/packages/calendar/tcl/calendar-procs.tcl 3 Apr 2018 09:21:16 -0000 1.36 +++ openacs-4/packages/calendar/tcl/calendar-procs.tcl 25 Apr 2018 12:03:28 -0000 1.37 @@ -22,23 +22,23 @@ given a date, and a time, construct the proper date string to be imported into oracle. (yyyy-mm-dd hh24:mi format)s } { - + # MUST CONVERT TO ARRAYS! (ben) array set event_date_arr $event_date if {$event_time ne ""} { array set event_time_arr $event_time } - - # extract from even-date + + # extract from even-date set year $event_date_arr(year) set day $event_date_arr(day) set month $event_date_arr(month) - + if {$event_time ne ""} { # extract from event_time set hours $event_time_arr(hours) set minutes $event_time_arr(minutes) - + # AM/PM? (ben - OpenACS fix) if {[info exists event_time_arr(ampm)]} { if {$event_time_arr(ampm)} { @@ -53,20 +53,20 @@ } } } - + if {$hours < 10} { set hours "0$hours" } } - + if {$month < 10} { - set month "0$month" + set month "0$month" } - + if {$day < 10} { - set day "0$day" + set day "0$day" } - + if {$event_time eq ""} { return "$year-$month-$day" } else { @@ -75,114 +75,114 @@ } ad_proc calendar::create { owner_id - private_p - {calendar_name ""} + private_p + {calendar_name ""} } { create a new calendar private_p is default to true since the default - calendar is a private calendar + calendar is a private calendar } { # find out configuration info set package_id [ad_conn package_id] set creation_ip [ad_conn "peeraddr"] set creation_user [ad_conn "user_id"] - + # BMA:FIXME: this needs to be fixed a LOT more, but for now we patch the obvious if {$creation_user == 0} { set creation_user $owner_id } set calendar_id [db_exec_plsql create_new_calendar { - begin - :1 := calendar.new( - owner_id => :owner_id, - private_p => :private_p, - calendar_name => :calendar_name, - package_id => :package_id, - creation_user => :creation_user, - creation_ip => :creation_ip - ); - end; + begin + :1 := calendar.new( + owner_id => :owner_id, + private_p => :private_p, + calendar_name => :calendar_name, + package_id => :package_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; } ] #removing inherited permissions permission::set_not_inherit -object_id $calendar_id - + return $calendar_id - + } ad_proc -public calendar::assign_permissions { calendar_id party_id cal_privilege - {revoke ""} + {revoke ""} } { given a calendar_id, party_id and a permission this proc will assign the permission to the party the legal permissions are public, private, calendar_read, calendar_write, calendar_delete - if the revoke is set, then the given permission will + if the revoke is set, then the given permission will be removed for the party } { - # default privilege is being able to read + # default privilege is being able to read # if the permission is public, oassign the magic object # and set permission to read if {$cal_privilege eq "public"} { - + set party_id [acs_magic_object "the_public"] - set cal_privilege "calendar_read" + set cal_privilege "calendar_read" } elseif {$cal_privilege eq "private"} { - set cal_privilege "calendar_read" - } + set cal_privilege "calendar_read" + } if { $revoke eq "" } { - # grant the permissions + # grant the permissions permission::grant -object_id $calendar_id -party_id $party_id -privilege $cal_privilege } elseif {$revoke eq "revoke"} { - # revoke the permissions + # revoke the permissions permission::revoke -object_id $calendar_id -party_id $party_id -privilege $cal_privilege - } + } } -ad_proc -public calendar::have_private_p { - {-return_id 0} +ad_proc -public calendar::have_private_p { + {-return_id 0} {-calendar_id_list {}} {-party_id party_id } } { Check to see if the user has a private calendar. When the provided -return_id is 1, then proc will return the calendar_id - @param calendar_id_list If you supply the calendar_id_list, then we'll only search + @param calendar_id_list If you supply the calendar_id_list, then we'll only search for a personal calendar among the calendars supplied here. } { # Check whether the user is logged in at all if {!$party_id} { - return -1 + return -1 } if { [llength $calendar_id_list] > 0 } { set result [db_string get_calendar_info_calendar_id_list {} -default 0] } else { set result [db_string get_calendar_info {} -default 0] } - + if { $result ne "0" } { - if {$return_id eq "1"} { - return $result - } else { - return 1 - } - + if {$return_id eq "1"} { + return $result + } else { + return 1 + } + } else { - - return 0 + + return 0 } } @@ -193,7 +193,7 @@ return [db_string get_calendar_name {} -default ""] } - + ad_proc -public calendar::get_month_multirow_information { {-current_day:required} {-today_julian_date:required} @@ -206,7 +206,7 @@ set last_day_of_week [expr {[expr {$first_day_of_week + 6}] % 7}] if {$current_day == $today_julian_date} { - set today_p t + set today_p t } else { set today_p f } @@ -232,9 +232,9 @@ {-sql_date:required} {-format:required} } { - + } { - # for now, we recognize only "YYYY-MM-DD" "HH12:MIam" and "HH24:MI". + # for now, we recognize only "YYYY-MM-DD" "HH12:MIam" and "HH24:MI". set date [template::util::date::create] switch -exact -- $format { @@ -249,10 +249,10 @@ {HH12:MIam} { regexp {([0-9]*):([0-9]*) *([aApP][mM])} $sql_date all hours minutes ampm - + set date [template::util::date::set_property format $date {HH12:MI am}] set date [template::util::date::set_property hours $date $hours] - set date [template::util::date::set_property minutes $date $minutes] + set date [template::util::date::set_property minutes $date $minutes] set date [template::util::date::set_property ampm $date [string tolower $ampm]] } @@ -319,7 +319,7 @@ if {$package_id eq ""} { set package_id [ad_conn package_id] } - + set permissions_clause {} if { $privilege ne "" } { set permissions_clause [db_map permissions_clause] @@ -361,12 +361,12 @@ return $calendar_id } -ad_proc -public calendar::personal_p { +ad_proc -public calendar::personal_p { {-calendar_id:required} {-user_id ""} } { Returns true (1) if this is the user's personal calendar, false (0) otherwise. - + @param user_id The user whose calendar you want to check } { if { $user_id eq "" } { @@ -377,7 +377,7 @@ return 1 } else { return 0 - } + } } ad_proc -public calendar::get { @@ -392,8 +392,8 @@ db_1row select_calendar {} -column_array row return [array get row] } - + ad_proc -public calendar::delete { {-calendar_id:required} } { @@ -434,7 +434,7 @@ db_transaction { # Remove the mappings for all events db_dml reset_item_types {} - + # Remove the item type db_dml delete_item_type {} } @@ -465,7 +465,7 @@ return 1 } elseif {$a_criterium < $b_criterium} { return -1 - } + } return 0 } @@ -519,20 +519,20 @@ -response_id $cal_item(cal_item_id) \ -notif_subject "$mode [_ calendar.Calendar_Item]: $cal_item(name)" \ -notif_text $new_content - + } - + ad_proc -public calendar::notification::get_url { object_id } { Returns a full URL to the object_id } { return [site_node::get_url_from_object_id -object_id $object_id] } - + # Local variables: # mode: tcl # tcl-indent-level: 4