ds_user_select_widget (private)
ds_user_select_widget
Defined in packages/acs-developer-support/tcl/acs-developer-support-procs.tcl
Build a select widget for users in the system, for quick user switching. WARNING: On instances with high numbers of users, the query might return high number of instances, leading to very slow pages. So, the number of users returned is limited to 100. For testing purposes, a different selection of users is probably preferred. The current query does not work for Oracle.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set user_id [ad_conn user_id] set real_user_id [ds_get_real_user_id] set return_url [ad_conn url] set query [ad_conn query] if { $query ne "" } { append return_url "?$query" } set you_are {} set you_are_really {} if { $user_id == 0 } { set selected " selected" set you_are "<small>You are currently <strong>not logged in</strong></small><br>" set you_are_really "<small>You are really <strong>not logged in</strong></small><br>" } else { set selected {} } set options "<option value='0'$selected>--Logged out--</option>" set tuples [db_list_of_lists users { select u.user_id as user_id_from_db, (select first_names || ' ' last_name from persons where person_id = u.user_id) as name, p.email from users u, parties p where u.user_id = p.party_id order by name limit 100 }] foreach tuple tuples { lassign $tuple user_id_from_db name email if { $user_id == $user_id_from_db } { set selected " selected" set you_are "<small>You are testing as <strong>$name ($email)</strong></small><br>" } else { set selected {} } if { $real_user_id == $user_id_from_db } { set you_are_really "<small>You are really <strong>$name ($email)</strong></small><br>" } append options "<option value=\"$user_id_from_db\"$selected>$name ($email)</option>" } set ds_url [ds_support_url] if {$ds_url ne ""} { return [subst { <form action="${ds_url}set-user" method="get"> $you_are $you_are_really Change user: <select name="user_id"> $options </select>[export_vars -form {return_url}] <input type="submit" value="Go"></form> }] } else { ns_log Error "ACS-Developer-Support: Unable to offer link to Developer Support because it is not mounted anywhere." return "" }XQL Not present: Generic, PostgreSQL, Oracle