From: <pre...@us...> - 2002-10-01 03:06:25
|
Update of /cvsroot/webnotes/webnotes/core In directory usw-pr-cvs1:/tmp/cvs-serv32174/core Modified Files: html_api.php util_api.php Log Message: added an option list method for the access levels. Index: html_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/html_api.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- html_api.php 29 Sep 2002 13:41:00 -0000 1.13 +++ html_api.php 1 Oct 2002 03:06:22 -0000 1.14 @@ -126,9 +126,9 @@ } ### -------------------- function print_admin_menu() { - global $g_logout, $g_admin_index_files, $g_admin_change_password, + global $g_logout, $g_admin_index_files, $g_admin_change_password, $g_admin_manage_notes, $g_admin_manage_users, - $s_logout_link, $s_index_files, $s_change_password, + $s_logout_link, $s_index_files, $s_change_password, $s_manage_notes, $s_manage_users, $g_user_home_page; $queue_count = note_queue_count(); @@ -163,4 +163,26 @@ echo "[ <a href=\"$p_link\">$p_url_text</a> ]"; } } -?> + ### -------------------- + function html_option_list_access_level( $p_access_level = '' ) { + echo '<option value="'.EVERYBODY.'" '; + check_selected( $p_access_level, EVERYBODY ); + echo '>everybody</option>'; + echo '<option value="'.ANONYMOUS.'" '; + check_selected( $p_access_level, ANONYMOUS ); + echo '>anonymous</option>'; + echo '<option value="'.REGISTERED.'" '; + check_selected( $p_access_level, REGISTERED ); + echo '>registered</option>'; + echo '<option value="'.MODERATOR.'" '; + check_selected( $p_access_level, MODERATOR ); + echo '>moderator</option>'; + echo '<option value="'.ADMINISTRATOR.'" '; + check_selected( $p_access_level, ADMINISTRATOR ); + echo '>administrator</option>'; + echo '<option value="'.NOBODY.'" '; + check_selected( $p_access_level, NOBODY ); + echo '>nobody</option>'; + } + ### -------------------- +?> \ No newline at end of file Index: util_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/util_api.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- util_api.php 11 Sep 2002 09:49:54 -0000 1.3 +++ util_api.php 1 Oct 2002 03:06:22 -0000 1.4 @@ -56,4 +56,13 @@ die; # additional output can cause problems so let's just stop output here } ### -------------------- + # If $p_var and $p_val are euqal to each other then we echo SELECTED + # This is used when we want to know if a variable indicated a certain + # option element is selected + function check_selected( $p_var, $p_val ) { + if ( $p_var == $p_val ) { + echo ' selected="selected" '; + } + } + ### -------------------- ?> |