ad_page_contract { This page checks all urls belonging to the user and lets him delete the ones that are dead. Since it is not easily possible to build a page incrementally (to flush) using the ArsDigita Templating System, I was forced to use the good old ns_write on this page. Credit for the ACS 3 version of this module goes to: @author David Hill (dh@arsdigita.com) @author Aurelius Prochazka (aure@arsdigita.com) The upgrade of this module to ACS 4 was done by @author Peter Marklund (pmarklun@arsdigita.com) @author Ken Kennedy (kenzoid@io.com) in December 2000. @creation-date December 2000 @cvs-id $Id: } { return_url {viewed_user_id:integer ""} } set page_title "Checking Bookmarks" set context_bar_args [bm_context_bar_args "\"$page_title\"" $viewed_user_id] set package_id [ad_conn package_id] set browsing_user_id [ad_conn user_id] if { [empty_string_p $viewed_user_id] } { # Only admins can call this page for all users ad_require_permission $package_id admin set root_folder_id $package_id } else { # Only check urls belonging to the viewed user set root_folder_id [bm_get_root_folder_id [ad_conn package_id] $viewed_user_id] } set check_list [db_list_of_lists bookmark_list " select url_id, complete_url, nvl(url_title, complete_url) as url_title from bm_urls where exists (select 1 from (select bookmark_id, url_id from bm_bookmarks start with parent_id = :root_folder_id connect by prior bookmark_id = parent_id) bm where bm.url_id = bm_urls.url_id and acs_permission.permission_p(bm.bookmark_id, :browsing_user_id, 'delete')= 't' )"] # We want to give the user something to look at before we start contacting # the foreign hosts ReturnHeaders ns_write "[ad_header $page_title]
" } else { ns_write "There are no bookmarks to check [ad_footer]" return } set form_opened_p f set dead_count 0 foreach check_set $check_list { set checked_url [ns_set create] set url_id [lindex $check_set 0] set complete_url [lindex $check_set 1] set url_title [lindex $check_set 2] # we only want to check http: if { [regexp -nocase "^mailto:" $complete_url] || [regexp -nocase "^file:" $complete_url] || (![regexp -nocase "^http:" $complete_url] && [regexp {^[^/]+:} $complete_url]) || [regexp "^\\#" $complete_url] } { # it was a mailto or an ftp:// or something (but not http://) # else that http_open won't like (or just plain #foobar) ns_write "
Skipping [ad_quotehtml $url_title] .... |