news-callback-procs.tcl

Library for news's callback implementations Callbacks for search package.

Location:
packages/news/tcl/news-callback-procs.tcl
Created:
2005-06-12
Author:
Dirk Gomez
CVS Identification:
$Id: news-callback-procs.tcl,v 1.4.2.1 2020/08/12 13:07:02 antoniop Exp $

Procedures in this file

Detailed information

callback::application-track::getApplicationName::impl::news (private)

 callback::application-track::getApplicationName::impl::news

callback implementation

See Also:
  • callback::application-track::getApplicationName::contract

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

callback::application-track::getGeneralInfo::impl::news (private)

 callback::application-track::getGeneralInfo::impl::news

callback implementation

See Also:
  • callback::application-track::getGeneralInfo::contract

Partial Call Graph (max 5 caller/called nodes):
%3 db_1row db_1row (public) callback::application-track::getGeneralInfo::impl::news callback::application-track::getGeneralInfo::impl::news callback::application-track::getGeneralInfo::impl::news->db_1row

Testcases:
No testcase defined.

callback::application-track::getSpecificInfo::impl::news (private)

 callback::application-track::getSpecificInfo::impl::news

callback implementation

See Also:
  • callback::application-track::getSpecificInfo::contract

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

callback::merge::MergePackageUser::impl::news (private)

 callback::merge::MergePackageUser::impl::news \
    -from_user_id from_user_id -to_user_id to_user_id

Merge the news of two users.

Switches:
-from_user_id
(required)
-to_user_id
(required)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 db_dml db_dml (public) callback::merge::MergePackageUser::impl::news callback::merge::MergePackageUser::impl::news callback::merge::MergePackageUser::impl::news->db_dml

Testcases:
No testcase defined.

callback::merge::MergeShowUserInfo::impl::news (private)

 callback::merge::MergeShowUserInfo::impl::news -user_id user_id

Show the news items

Switches:
-user_id
(required)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 db_list_of_lists db_list_of_lists (public) callback::merge::MergeShowUserInfo::impl::news callback::merge::MergeShowUserInfo::impl::news callback::merge::MergeShowUserInfo::impl::news->db_list_of_lists

Testcases:
No testcase defined.
[ hide source ]

Content File Source

ad_library {
    Library for news's callback implementations

    Callbacks for search package.

    @author Dirk Gomez <openacs@dirkgomez.de>
    @creation-date 2005-06-12
    @cvs-id $Id: news-callback-procs.tcl,v 1.4.2.1 2020/08/12 13:07:02 antoniop Exp $
}

d_proc -callback merge::MergeShowUserInfo -impl news {
    -user_id:required
} {
    Show the news items
} {
    set msg "News items of $user_id"
    ns_log Notice $msg
    set result [list $msg]

    set news [db_list_of_lists getaprovednews {}]

    lappend result $news

    return $result
}

d_proc -callback merge::MergePackageUser -impl news {
    -from_user_id:required
    -to_user_id:required
} {
    Merge the news of two users.
} {
    set msg "Merging news"
    ns_log Notice $msg
    set result [list $msg]

    db_dml update_from_news_approval {}

    lappend result "Merge of news is done"

    return $result
}

#Callbacks for application-track

d_proc -callback application-track::getApplicationName -impl news {} {
    callback implementation
} {
    return "news"
}

d_proc -callback application-track::getGeneralInfo -impl news {} {
    callback implementation
} {
    db_1row my_query {
        select count(n.item_id) as result
        FROM news_items_approved n, dotlrn_class_instances_full com
        WHERE class_instance_id=:comm_id
        and apm_package__parent_id(n.package_id) = com.package_id
    }

    return "$result"
}


d_proc -callback application-track::getSpecificInfo -impl news {} {
    callback implementation
} {

    upvar $query_name my_query
    upvar $elements_name my_elements

    set my_query {
        SELECT news.publish_title as name, news.pretty_publish_date as initial_date, news.publish_date as finish_date
        FROM news_items_approved news,dotlrn_communities_full com
        WHERE community_id=:class_instance_id
        and apm_package__parent_id(news.package_id) = com.package_id }

    set my_elements {
        name {
            label "Name"
            display_col name
            html {align center}

        }
        initial_date {
            label "Initial Date"
            display_col initial_date
            html {align center}
        }
        finish_date {
            label "Finish Date"
            display_col finish_date
            html {align center}
        }
    }
    return "OK"
}

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