bm_set_hidden_p

one of the documented procedures in this installation of the ACS
Usage:
bm_set_hidden_p   db   owner_id
What it does:
This procedure insures that the 'hidden_p' column in the 'bm_list' table is consistant with the privacy of the folder structure (ie a bookmark inside a private folder or in a folder in a private folder etc is considered to be hidden_p=t)
Defined in: /web/philip/tcl/bookmarks-defs.tcl

Source code:



    # get the bad parents
    set sql_get_bad "
        select  bookmark_id
        from    bm_list
        where   owner_id = $owner_id
        and     private_p = 't'"

    set bad_parents [database_to_tcl_list $db $sql_get_bad]
    set bad_parents [join $bad_parents ","]

    # this could be trouble if the bad_parents list is too long 
    if { ![empty_string_p $bad_parents] } {
	# get all the 'bookmark_id's which should be public
	set sql_get_new_public "
	    select  bookmark_id
    	    from    bm_list 
	    where   owner_id = $owner_id
	    and     private_p <> 't'
	    connect by  prior bookmark_id = parent_id
	    and parent_id  not in ($bad_parents)
	    start with parent_id is NULL"

	set not_hidden_list  [database_to_tcl_list $db $sql_get_new_public]
	

	# set _all_ 'bookmark_id's hidden_p='t' then set the 'bookmarks_id's in not_hidden_list to hidden_p='f'
	ns_db dml $db "
	    update  bm_list
	    set     hidden_p = 't'
	    where   owner_id = $owner_id "
	foreach bookmark_id $not_hidden_list {
	    ns_db dml $db "
	        update bm_list
	        set    hidden_p = 'f'
	        where  bookmark_id = $bookmark_id
	        and    owner_id = $owner_id" 
	}
    } else {
	ns_db dml $db "
	    update bm_list
	    set    hidden_p = 'f'
	    where  owner_id = $owner_id"
    }


philg@mit.edu