revision-info.tcl
- Location:
- /packages/acs-subsite/www/admin/system/revision-info.tcl
- Author:
- Peter Alberer peter@alberer.com
- Created:
- 27 October 2003
Related Files
[ hide source ] | [ make this the default ]
File Contents
ad_page_contract { @author Peter Alberer peter@alberer.com @creation-date 27 October 2003 } { community_id:notnull restype:notnull {offset:integer,optional 0} } #funktionen: #-object listen anzeigen proc check_item { location item_id {revision_id 0} } { set sql_str "select 1 from $location where lr_object_id = :item_id" if { $revision_id != 0 } { append sql_str " and revision_id = :revision_id" } else { append sql_str " and revision_id is null" } set result [db_string get_data $sql_str -default 0] return $result } proc html { level value } { upvar output out $value val set indent "" for { set i 0 } { $i < $level } { incr i } { append out "--" } append out " $value: $val<br>" } set sql_str { select lr_object_id, lr_title, restype, live_revision from lr_objects lro, cr_items cri where lro.lr_object_id = cri.item_id and restype = :restype and community_id = :community_id order by restype, lr_title } set item_list [list] set output "<title>$restype</title>" db_foreach get_data $sql_str { lappend item_list $lr_object_id $lr_title $restype $live_revision } foreach { lr_object_id title restype live_revision } $item_list { append output "<p><b>$restype $title</b><br>" html 1 lr_object_id set item_deleted [check_item lr_delete_cache $lr_object_id] set item_preserved [check_item lr_preserved_for_homework $lr_object_id] if { $restype eq "exam" } { set references [db_string get_data "select lr_exam__homework_reference_count($lr_object_id, null)"] } else { set references [db_string get_data "select lr_exercise__homework_reference_count($lr_object_id, null)"] } html 1 item_deleted html 1 item_preserved html 1 references if { $restype eq "exam" } { set sql_str { select lre.lr_exam_revision_id, revision_lock_p, excs_list_hash from cr_revisions crr, lr_exams lre where lre.lr_exam_revision_id = crr.revision_id and crr.item_id = :lr_object_id order by lre.lr_exam_revision_id } set revision_list [list] set revision_count 0 db_foreach get_data $sql_str { incr revision_count lappend revision_list $lr_exam_revision_id $revision_lock_p $excs_list_hash } append output "-- <b>Revisions ($revision_count)</b><br>" foreach { lr_exam_revision_id revision_lock_p excs_list_hash } $revision_list { html 2 lr_exam_revision_id if { $live_revision == $lr_exam_revision_id } { append output "---- <b>This is the live revision</b><br>" } html 3 revision_lock_p html 3 excs_list_hash set revision_deleted [check_item lr_delete_cache $lr_object_id $lr_exam_revision_id] set revision_preserved [check_item lr_preserved_for_homework $lr_object_id $lr_exam_revision_id] set references [db_string get_data "select lr_exam__homework_reference_count($lr_object_id, $lr_exam_revision_id)"] html 3 revision_deleted html 3 revision_preserved html 3 references } } elseif { $restype eq "excs" } { set sql_str { select crr.revision_id from cr_revisions crr where crr.item_id = :lr_object_id order by crr.revision_id } set revision_list [list] set revision_count 0 db_foreach get_data $sql_str { incr revision_count lappend revision_list $revision_id } append output "-- <b>Revisions ($revision_count)</b><br>" foreach { revision_id } $revision_list { html 2 revision_id if { $live_revision == $revision_id } { append output "---- <b>This is the live revision</b><br>" } set revision_deleted [check_item lr_delete_cache $lr_object_id $revision_id] set revision_preserved [check_item lr_preserved_for_homework $lr_object_id $revision_id] set references [db_string get_data "select lr_exercise__homework_reference_count($lr_object_id, $revision_id)"] html 3 revision_deleted html 3 revision_preserved html 3 references } } set sql_str "select item_id, name, content_type from cr_items where parent_id = :lr_object_id" set child_list [list] set child_count 0 db_foreach get_data $sql_str { lappend child_list $item_id $name $content_type } if { $child_count == 0 } { continue } append output "-- <b>Child Ressources ($child_count)</b><br>" foreach { item_id name content_type } $child_list { html 3 item_id html 3 name html 3 content_type } append output "<br>" } ns_return 200 "text/html" $output