diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 37f28e2b7a..9a565a6197 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1,5 +1,50 @@ ID) { + $checked_categories = $wpdb->get_col(" + SELECT category_id + FROM $tablecategories, $tablepost2cat + WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post->ID' + "); + } else { + $checked_categories[] = $default; + } + + $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY category_parent DESC"); + $result = array(); + foreach($categories as $category) { + $array_category = get_object_vars($category); + $me = 0 + $category->cat_ID; + $parent = 0 + $category->category_parent; + $array_category['children'] = $result[$me]; + $array_category['checked'] = in_array($category->cat_ID, $checked_categories); + $array_category['cat_name'] = stripslashes($category->cat_name); + $result[$parent][] = $array_category; + } + + return $result[0]; +} + +function write_nested_categories($categories) { + foreach($categories as $category) { + echo '\n"; + + if(isset($category['children'])) { + echo "\n\n"; + write_nested_categories($category['children'], $count); + echo "\n"; + } + } +} + +function dropdown_categories($default = 0) { + write_nested_categories(get_nested_categories($default)); +} // Dandy new recursive multiple category stuff. function cat_rows($parent = 0, $level = 0, $categories = 0) { diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 11e5bd89c6..0bd05081e5 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -65,6 +65,11 @@ fieldset legend { padding: .1em; } +fieldset span.cat-nest { + display: block; + margin-left: 10px; +} + form, label input { margin: 0; padding: 0; @@ -91,8 +96,8 @@ p, dl, dd, dt { textarea, input, select { background: #f4f4f4; - color: black; border: 1px solid #cacaca; + color: #000; font-family: Georgia, "Times New Roman", Times, serif; margin: 1px; padding: 2px; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 7e84a104f8..ff855022b9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -396,31 +396,6 @@ function profile($user_login) { echo "user_login."','Profile','toolbar=0,status=1,location=0,directories=0,menuBar=1,scrollbars=1,resizable=0,width=480,height=320,left=100,top=100'); return false;\">$user_login"; } -function dropdown_categories($default = 0) { - global $post, $tablecategories, $tablepost2cat, $mode, $wpdb; - $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name"); - - if ($post->ID) { - $postcategories = $wpdb->get_col(" - SELECT category_id - FROM $tablecategories, $tablepost2cat - WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post->ID' - "); - } else { - $postcategories[] = $default; - } - - foreach($categories as $category) { - ++$i; - $category->cat_name = stripslashes($category->cat_name); - echo "\n "; - } - -} - function touch_time($edit = 1) { global $month, $postdata, $time_difference; // echo $postdata['Date'];