Changeset 581
- Timestamp:
- 01/10/2007 09:04:14 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-admin/admin-ajax.php
r541 r581 91 91 break; 92 92 93 case 'update-resolution' :94 $topic_id = (int) @$_POST['topic_id'];95 $resolved = @$_POST['resolved'];96 97 if ( !bb_current_user_can( 'edit_topic', $topic_id ) )98 die('-1');99 100 $topic = get_topic( $topic_id );101 if ( !$topic )102 die('0');103 104 if ( bb_resolve_topic( $topic_id, $resolved ) ) {105 $topic->topic_resolved = $resolved;106 ob_start();107 echo '<li id="resolution-flipper">' . __('This topic is') . ' ';108 topic_resolved();109 echo '</li>';110 $data = ob_get_contents();111 ob_end_clean();112 $x = new WP_Ajax_Response( array(113 'what' => 'resolution',114 'id' => 'flipper',115 'data' => $data116 ) );117 $x->send();118 }119 break;120 121 93 case 'delete-post' : 122 94 $post_id = (int) $_POST['id']; -
trunk/bb-includes/functions.php
r578 r581 89 89 function untagged( $where ) { 90 90 return $where . ' AND tag_count = 0 '; 91 }92 93 function unresolved( $where ) {94 return $where . " AND topic_resolved = 'no' ";95 91 } 96 92 … … 920 916 if ( $user = bb_get_user( $bb_post->poster_id ) ) 921 917 bb_update_usermeta( $user->ID, $bb_table_prefix . 'topics_replied', $user->topics_replied + 1 ); 922 }923 924 function bb_resolve_topic( $topic_id, $resolved = 'yes' ) {925 global $bbdb, $bb_cache;926 $topic_id = (int) $topic_id;927 apply_filters( 'topic_resolution', $resolved, $topic_id );928 if ( ! in_array($resolved, array('yes', 'no', 'mu')) )929 return false;930 $bb_cache->flush_one( 'topic', $topic_id );931 $r = $bbdb->query("UPDATE $bbdb->topics SET topic_resolved = '$resolved' WHERE topic_id = '$topic_id'");932 do_action( 'resolve_topic', $topic_id, $resolved, $r );933 return $r;934 918 } 935 919 … … 1556 1540 if ( isset($views) && $cache ) 1557 1541 return $views; 1558 $views = array('no-replies' => __('Topics with no replies'), 'untagged' => __('Topics with no tags'), 'unresolved' => __('Unresolved topics')); 1559 return apply_filters('bb_views', $views); 1542 1543 $views = array( 1544 'no-replies' => __('Topics with no replies'), 1545 'untagged' => __('Topics with no tags'), 1546 ); 1547 1548 $views = apply_filters('bb_views', $views); 1549 return $views; 1560 1550 } 1561 1551 -
trunk/bb-includes/js/topic-js.php
r516 r581 59 59 favLinkSetup(); 60 60 61 var resolvedSub = $('resolvedformsub');62 if ( !resolvedSub )63 return;64 resFunc = function(e) { return theTopicMeta.ajaxUpdater( 'resolution', 'resolved' ); }65 resolvedSub.onclick = resFunc;66 theTopicMeta.addComplete = function(what, where, update) {67 if ( update && 'resolved' == where )68 $('resolvedformsub').onclick = resFunc;69 }70 61 } ); 71 62 -
trunk/bb-includes/template-functions.php
r580 r581 599 599 } 600 600 601 function topic_resolved( $yes = '', $no = '', $mu = '', $id = 0 ) {602 global $bb_current_user, $topic;603 if ( empty($yes) )604 $yes = __('resolved');605 if ( empty($no) )606 $no = __('not resolved');607 if ( empty($mu) )608 $mu = __('not a support question');609 if ( bb_current_user_can( 'edit_topic', $topic->topic_id ) ) :610 $resolved_form = '<form id="resolved" method="post" action="' . bb_get_option('uri') . 'topic-resolve.php"><div>' . "\n";611 $resolved_form .= '<input type="hidden" name="id" value="' . $topic->topic_id . "\" />\n";612 $resolved_form .= '<select name="resolved" id="resolvedformsel" tabindex="2">' . "\n";613 614 $cases = array( 'yes', 'no', 'mu' );615 $resolved = get_topic_resolved( $id );616 foreach ( $cases as $case ) {617 $selected = ( $case == $resolved ) ? ' selected="selected"' : '';618 $resolved_form .= "<option value=\"$case\"$selected>${$case}</option>\n";619 }620 621 $resolved_form .= "</select>\n";622 $resolved_form .= '<input type="submit" name="submit" id="resolvedformsub" value="'. __('Change') .'" />' . "\n</div>";623 echo $resolved_form;624 bb_nonce_field( 'resolve-topic_' . $topic->topic_id );625 echo "\n</form>";626 else:627 switch ( get_topic_resolved( $id ) ) {628 case 'yes' : echo $yes; break;629 case 'no' : echo $no; break;630 case 'mu' : echo $mu; break;631 }632 endif;633 }634 635 function get_topic_resolved( $id = 0 ) {636 global $topic;637 if ( $id )638 $topic = get_topic( $id );639 return $topic->topic_resolved;640 }641 642 601 function topic_last_post_link( $id = 0 ) { 643 602 global $topic; … … 784 743 elseif ( 1 < $topic->topic_status && bb_current_user_can( 'browse_deleted' ) ) 785 744 $class[] = 'bozo'; 786 if ( 'yes' == $topic->topic_resolved )787 $class[] = 'resolved';788 745 if ( '0' === $topic->topic_open ) 789 746 $class[] = 'closed'; -
trunk/bb-post.php
r516 r581 23 23 $topic = trim( $_POST['topic'] ); 24 24 $tags = trim( $_POST['tags'] ); 25 $support = (int) $_POST['support'];26 25 27 26 if ('' == $topic) … … 29 28 30 29 $topic_id = bb_new_topic( $topic, $forum, $tags ); 31 if ( 1 != $support ) 32 bb_resolve_topic( $topic_id, 'mu' ); 30 33 31 } elseif ( isset($_POST['topic_id'] ) ) { 34 32 $topic_id = (int) $_POST['topic_id']; -
trunk/bb-templates/topic.php
r528 r581 12 12 <li><?php printf(__('<a href="%1$s">Latest reply</a> from %2$s'), get_topic_last_post_link(), get_topic_last_poster()) ?></li> 13 13 <?php endif; ?> 14 <li id="resolution-flipper"><?php _e('This topic is') ?> <?php topic_resolved(); ?></li>15 14 <?php if ( $bb_current_user ) : $class = 0 === is_user_favorite( $bb_current_user->ID ) ? ' class="is-not-favorite"' : ''; ?> 16 15 <li<?php echo $class;?> id="favorite-toggle"><?php user_favorites_link() ?></li> -
trunk/topic-resolve.php
r516 r581 1 <?php2 require('./bb-load.php');3 4 bb_auth();5 6 if ( !$bb_current_user )7 bb_die(__('You need to be logged in to add a tag.'));8 9 $topic_id = (int) @$_POST['id' ];10 $resolved = @$_POST['resolved'];11 12 $topic = get_topic ( $topic_id );13 if ( !$topic )14 bb_die(__('Topic not found.'));15 16 if ( !bb_current_user_can( 'edit_topic', $topic_id ) )17 bb_die(__("You must be either the original poster or a moderator to change a topic's resolution status."));18 19 bb_check_admin_referer( 'resolve-topic_' . $topic_id );20 21 if ( bb_resolve_topic( $topic_id, $resolved ) )22 wp_redirect( get_topic_link( $topic_id ) );23 else24 bb_die(__('Invalid resolution status.'));25 ?> -
trunk/view.php
r516 r581 18 18 $view_count = max($view_count, bb_count_last_query()); 19 19 break; 20 case 'unresolved' :21 add_filter( 'get_latest_topics_where', 'unresolved' );22 $topics = get_latest_topics( 0, $page );23 $view_count = bb_count_last_query();24 break;25 20 default : 26 do_action( 'bb_custom_view', $view );21 do_action( 'bb_custom_view', $view, $page ); 27 22 endswitch; 28 23
Note: See TracChangeset
for help on using the changeset viewer.