Changeset 1531
- Timestamp:
- 05/14/08 17:18:17 (7 months ago)
- Files:
-
- trunk/bb-admin/admin-functions.php (modified) (7 diffs)
- trunk/bb-includes/template-functions.php (modified) (4 diffs)
- trunk/bb-templates/kakumei/forum.php (modified) (1 diff)
- trunk/bb-templates/kakumei/front-page.php (modified) (1 diff)
- trunk/bb-templates/kakumei/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bb-admin/admin-functions.php
r1528 r1531 506 506 return false; 507 507 508 $defaults = array( 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => false );508 $defaults = array( 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => false, 'forum_is_category' => 0 ); 509 509 $args = wp_parse_args( $args, $defaults ); 510 510 if ( 1 < func_num_args() ) : // For back compat … … 521 521 $forum_order = (int) $forum_order; 522 522 $forum_parent = (int) $forum_parent; 523 $forum_is_category = (int) $forum_is_category; 523 524 524 525 $forum_name = apply_filters( 'bb_pre_forum_name', stripslashes($forum_name) ); … … 540 541 $bbdb->insert( $bbdb->forums, compact( 'forum_name', 'forum_slug', 'forum_desc', 'forum_parent', 'forum_order' ) ); 541 542 $forum_id = $bbdb->insert_id; 542 543 if ($forum_id && $forum_is_category) 544 bb_update_forummeta($forum_id, 'forum_is_category', $forum_is_category); 543 545 wp_cache_flush( 'bb_forums' ); 544 546 … … 552 554 return false; 553 555 554 $defaults = array( 'forum_id' => 0, 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => 0 );556 $defaults = array( 'forum_id' => 0, 'forum_name' => '', 'forum_desc' => '', 'forum_parent' => 0, 'forum_order' => 0, 'forum_is_category' => 0 ); 555 557 $args = wp_parse_args( $args, $defaults ); 556 558 if ( 1 < func_num_args() ) : // For back compat … … 567 569 $forum_order = (int) $forum_order; 568 570 $forum_parent = (int) $forum_parent; 571 $forum_is_category = (int) $forum_is_category; 569 572 570 573 $forum_name = apply_filters( 'bb_pre_forum_name', stripslashes($forum_name) ); … … 578 581 wp_cache_flush( 'bb_forums' ); 579 582 580 return $bbdb->update( $bbdb->forums, compact( 'forum_name', 'forum_desc', 'forum_parent', 'forum_order' ), compact( 'forum_id' ) ); 583 $update_result = $bbdb->update( $bbdb->forums, compact( 'forum_name', 'forum_desc', 'forum_parent', 'forum_order' ), compact( 'forum_id' ) ); 584 if ($update_result) 585 if ($forum_is_category) 586 bb_update_forummeta($forum_id, 'forum_is_category', $forum_is_category); 587 else 588 bb_delete_forummeta($forum_id, 'forum_is_category'); 589 return $update_result; 581 590 } 582 591 … … 662 671 </tr> 663 672 <tr id="forum-parent-row"><th scope="row"><label for="forum_parent"><?php _e('Forum Parent:'); ?></label></th> 664 <td><?php bb_forum_dropdown( array('cut_branch' => $forum_id, 'id' => 'forum_parent', 'none' => true, 'selected' => $forum_id ? get_forum_parent( $forum_id ) : 0 ) ); ?></td>673 <td><?php bb_forum_dropdown( array('cut_branch' => $forum_id, 'id' => 'forum_parent', 'none' => true, 'selected' => $forum_id ? get_forum_parent( $forum_id ) : 0, 'disable_categories' => 0) ); ?></td> 665 674 </tr> 666 675 <tr id="forum-position-row"><th scope="row"><label for="forum-order"><?php _e('Position:'); ?></label></th> 667 676 <td><input type="text" name="forum_order" id="forum-order" value="<?php if ( $forum_id ) echo get_forum_position( $forum_id ); ?>" tabindex="12" maxlength="10" class="widefat" /></td> 677 </tr> 678 <tr id="forum-is-category-row"><th scope="row"><label for="forum-is-category"><?php _e('Forum is Category:'); ?></label></th> 679 <td><input type="checkbox" name="forum_is_category" id="forum-is-category" value="1" <?php if ( $forum_id && bb_get_forum_is_category($forum_id) ) : ?>checked="checked" <?php endif; ?>tabindex="13" /></td> 668 680 </tr> 669 681 </table> trunk/bb-includes/template-functions.php
r1517 r1531 130 130 function post_form( $h2 = '' ) { 131 131 global $page, $topic, $forum; 132 133 if ($forum->forum_is_category) 134 return; 135 132 136 $add = topic_pages_add(); 133 137 if ( empty($h2) && false !== $h2 ) { … … 547 551 } 548 552 553 function bb_get_forum_is_category( $forum_id = 0 ) { 554 $forum = get_forum( get_forum_id( $forum_id ) ); 555 return apply_filters( 'bb_get_forum_is_category', $forum->forum_is_category, $forum->forum_id ); 556 } 557 549 558 function forum_topics( $forum_id = 0 ) { 550 559 echo apply_filters( 'forum_topics', get_forum_topics( $forum_id ), $forum_id ); … … 2208 2217 2209 2218 function bb_get_forum_dropdown( $args = '' ) { 2210 $defaults = array( 'callback' => false, 'callback_args' => false, 'id' => 'forum_id', 'none' => false, 'selected' => false, 'tab' => 5, 'hierarchical' => 1, 'depth' => 0, 'child_of' => 0 );2219 $defaults = array( 'callback' => false, 'callback_args' => false, 'id' => 'forum_id', 'none' => false, 'selected' => false, 'tab' => 5, 'hierarchical' => 1, 'depth' => 0, 'child_of' => 0, 'disable_categories' => 1 ); 2211 2220 if ( $args && is_string($args) && false === strpos($args, '=') ) 2212 2221 $args = array( 'callback' => $args ); … … 2231 2240 $none = __('- None -'); 2232 2241 2233 $r = "<select name='$name' id='$id' tabindex='$tab'>\n";2242 $r = '<select name="' . $name . '" id="' . $id . '" tabindex="' . $tab . '">' . "\n"; 2234 2243 if ( $none ) 2235 $r .= "\n<option value='0'>$none</option>\n"; 2236 2244 $r .= "\n" . '<option value="0">' . $none . '</option>' . "\n"; 2245 2246 $no_option_selected = true; 2247 $options = array(); 2237 2248 while ( $depth = bb_forum() ) : 2238 2249 global $forum; // Globals + References = Pain 2239 $_selected = ( !$selected && $forum_id == $forum->forum_id || $selected == $forum->forum_id ) ? " selected='selected'" : ''; 2240 $r .= "\n<option value='$forum->forum_id'$_selected>" . str_repeat( ' ', $depth - 1 ) . " $forum->forum_name</option>\n"; 2250 if ($disable_categories && $forum->forum_is_category) { 2251 $options[] = array( 2252 'value' => 0, 2253 'display' => str_repeat( ' ', $depth - 1 ) . $forum->forum_name, 2254 'disabled' => true, 2255 'selected' => false 2256 ); 2257 continue; 2258 } 2259 $_selected = false; 2260 if ( (!$selected && $forum_id == $forum->forum_id) || $selected == $forum->forum_id ) { 2261 $_selected = true; 2262 $no_option_selected = false; 2263 } 2264 $options[] = array( 2265 'value' => $forum->forum_id, 2266 'display' => str_repeat( ' ', $depth - 1 ) . $forum->forum_name, 2267 'disabled' => false, 2268 'selected' => $_selected 2269 ); 2241 2270 endwhile; 2271 2272 foreach ($options as $option_index => $option_value) { 2273 if (!$none && !$selected && $no_option_selected && !$option_value['disabled']) { 2274 $option_value['selected'] = true; 2275 $no_option_selected = false; 2276 } 2277 $option_disabled = $option_value['disabled'] ? ' disabled="disabled"' : ''; 2278 $option_selected = $option_value['selected'] ? ' selected="selected"' : ''; 2279 $r .= "\n" . '<option value="' . $option_value['value'] . '"' . $option_disabled . $option_selected . '>' . $option_value['display'] . '</option>' . "\n"; 2280 } 2281 2242 2282 $forum = $old_global; 2243 $r .= "</select>\n";2283 $r .= '</select>' . "\n"; 2244 2284 return $r; 2245 2285 } trunk/bb-templates/kakumei/forum.php
r1337 r1531 48 48 49 49 <?php while ( bb_forum() ) : ?> 50 <?php if (bb_get_forum_is_category()) : ?> 51 <tr<?php bb_forum_class('bb-category'); ?>> 52 <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td> 53 </tr> 54 <?php continue; endif; ?> 50 55 <tr<?php bb_forum_class(); ?>> 51 56 <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td> trunk/bb-templates/kakumei/front-page.php
r1337 r1531 51 51 </tr> 52 52 <?php while ( bb_forum() ) : ?> 53 <?php if (bb_get_forum_is_category()) : ?> 54 <tr<?php bb_forum_class('bb-category'); ?>> 55 <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td> 56 </tr> 57 <?php continue; endif; ?> 53 58 <tr<?php bb_forum_class(); ?>> 54 59 <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td> trunk/bb-templates/kakumei/style.css
r1508 r1531 478 478 padding: 5px 10px; 479 479 text-transform: uppercase; 480 } 481 482 tr.bb-category td { 483 background-color: #ddd; 480 484 } 481 485