I have done some work on the widget, although I haven't actually used ad_categorize_row. The widget wasn't showing the correct category hierarchy, so I was working on fixing it. I never posted my fix, because I didn't completely resolve the problems. I did manage to get it to display the relationships between categorization and subcategorization levels, although it still doesn't sort them alphabetically.
I changed the code for ad_categorization_widget from this:
# Fetch the entire category hierarchy.
#
set selection [ns_db select $db "select c.category_id, lpad(' ', 12*(category_hierarchy_level(c.category_id, NULL, 0) - 1),' ') as indent, c.category, c.category_type
from categories c
order by category_hierarchy_sortkey(c.category_id, NULL,'')"]
to this:
# Fetch the entire category hierarchy.
#
set selection [ns_db select $db "
SELECT c.category_id,
lpad(' ', 12*(category_hierarchy_level(c.category_id, '', 0) - 1),' ') as indent,
c.category,
c.category_type
FROM categories c,
category_hierarchy h,
category_hierarchy h1
WHERE c.category_id = h.child_category_id
AND h1.parent_category_id IS NULL
AND category_hierarchy_level(h.child_category_id, h1.child_category_id, 0) is not null
ORDER BY category_type,
category_hierarchy_sortkey(h.child_category_id, h1.child_category_id, ''),
category_hierarchy_level(c.category_id, '', 0)"]
My formatting makes it a little more difficult to see, but the changes are
1) In the SELECT statement, changing the "NULL" in the call to category_hierarchy_level.
2) Adding to and changing the order of the ORDER BY statements.
I am still working on getting everything to sort alphabetically, but I believe that will involve creating another PL/PGSQL function.
The "general-links" module uses the categorization widget and the content mapping feature, and it might be a good example for you to start with. It seems to work correctly, so if you add a link with associated categories it will insert it into "site_wide_category_map".