apm-callback-procs.tcl

Calendar Package APM callbacks library Procedures that deal with installing, instantiating, mounting.

Location:
packages/calendar/tcl/apm-callback-procs.tcl
Created:
July 2007
Author:
rmorales@innova.uned.es
CVS Identification:
$Id: apm-callback-procs.tcl,v 1.3.2.2 2021/02/26 19:18:24 gustafn Exp $

Procedures in this file

Detailed information

calendar::apm::before_uninstantiate (private)

 calendar::apm::before_uninstantiate -package_id package_id

Cleanup calendars from this package instance upon uninstantiation.

Switches:
-package_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 calendar::delete calendar::delete (public) calendar::item::delete calendar::item::delete (public) calendar::item_type_delete calendar::item_type_delete (public) db_foreach db_foreach (public) db_list db_list (public) calendar::apm::before_uninstantiate calendar::apm::before_uninstantiate calendar::apm::before_uninstantiate->calendar::delete calendar::apm::before_uninstantiate->calendar::item::delete calendar::apm::before_uninstantiate->calendar::item_type_delete calendar::apm::before_uninstantiate->db_foreach calendar::apm::before_uninstantiate->db_list

Testcases:
No testcase defined.

calendar::apm::package_after_upgrade (private)

 calendar::apm::package_after_upgrade \
    -from_version_name from_version_name \
    -to_version_name to_version_name

Upgrade script for the calendar package

Switches:
-from_version_name (required)
-to_version_name (required)

Partial Call Graph (max 5 caller/called nodes):
%3 apm_upgrade_logic apm_upgrade_logic (public) db_dml db_dml (public) db_transaction db_transaction (public) calendar::apm::package_after_upgrade calendar::apm::package_after_upgrade calendar::apm::package_after_upgrade->apm_upgrade_logic calendar::apm::package_after_upgrade->db_dml calendar::apm::package_after_upgrade->db_transaction

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {

    Calendar Package APM callbacks library

    Procedures that deal with installing, instantiating, mounting.

    @creation-date July 2007
    @author rmorales@innova.uned.es
    @cvs-id $Id: apm-callback-procs.tcl,v 1.3.2.2 2021/02/26 19:18:24 gustafn Exp $
}

namespace eval calendar {}
namespace eval calendar::apm {}


d_proc -private calendar::apm::package_after_upgrade {
    -from_version_name:required
    -to_version_name:required
} {
    Upgrade script for the calendar  package
} {
    apm_upgrade_logic \
    -from_version_name $from_version_name \
    -to_version_name $to_version_name \
    -spec {
        2.1.0b7 2.1.0b8 {
            db_transaction {
                db_dml update_context {}
                db_dml remove_personal_notifications {}
            } on_error {
                ns_log Error "Error:$errmsg"
            }
        }
    }
}

d_proc -private calendar::apm::before_uninstantiate {
    -package_id:required
} {
    Cleanup calendars from this package instance upon uninstantiation.
} {
    # get calendar ids
    set calendar_list [db_list get_calendar_ids {
        SELECT calendar_id FROM calendars
         WHERE package_id = :package_id
    }]
    # delete calendars
    foreach calendar_id $calendar_list {
        # delete all calendar items
        db_foreach get_calendar_items {
            SELECT cal_item_id FROM cal_items
             WHERE on_which_calendar = :calendar_id
        } {
            calendar::item::delete -cal_item_id $cal_item_id
        }
        # delete item types
        db_foreach get_item_types {
            SELECT item_type_id FROM cal_item_types
             WHERE calendar_id= :calendar_id
        } {
            calendar::item_type_delete -calendar_id $calendar_id -item_type_id $item_type_id
        }
        # delete calendar
        calendar::delete -calendar_id $calendar_id
    }
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: