// Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $user_modeartion_statuses, 'user_perm' => 'moderate', 'post_statuses' => array('published', 'community', 'protected'), 'order' => 'DESC', 'comments' => 30)); // Set param prefix for URLs $param_prefix = 'cmnt_fullview_'; if (!empty($CommentList->param_prefix)) { $param_prefix = $CommentList->param_prefix; } // Get ready for display (runs the query): $CommentList->display_init(); } if ($user_perm_moderate_cmt && $CommentList->result_num_rows) { // We have comments awaiting moderation load_funcs('comments/model/_comment_js.funcs.php'); $nb_blocks_displayed++; $opentrash_link = get_opentrash_link(true, false, array('class' => 'btn btn-default')); $refresh_link = '<span class="floatright">' . action_icon(T_('Refresh comment list'), 'refresh', $admin_url . '?blog=' . $blog, ' ' . T_('Refresh'), 3, 4, array('onclick' => 'startRefreshComments( \'' . request_from() . '\' ); return false;', 'class' => 'btn btn-default')) . '</span> '; $show_statuses_param = $param_prefix . 'show_statuses[]=' . implode('&' . $param_prefix . 'show_statuses[]=', $user_modeartion_statuses); $block_item_Widget->title = $refresh_link . $opentrash_link . T_('Comments awaiting moderation') . ' <a href="' . $admin_url . '?ctrl=comments&blog=' . $Blog->ID . '&' . $show_statuses_param . '" style="text-decoration:none">' . '<span id="badge" class="badge badge-important">' . $CommentList->get_total_rows() . '</span></a>' . get_manual_link('collection-dashboard'); echo '<div class="evo_content_block">'; echo '<div id="comments_block" class="dashboard_comments_block">'; $block_item_Widget->disp_template_replaced('block_start'); echo '<div id="comments_container">'; // GET COMMENTS AWAITING MODERATION (the code generation is shared with the AJAX callback): show_comments_awaiting_moderation($Blog->ID, $CommentList); echo '</div>'; $block_item_Widget->disp_template_raw('block_end'); echo '</div>'; echo '</div>'; } /* * RECENT POSTS awaiting moderation
/** * Get any kind of moderation link where the user status will be changed. * This function should be private! * TODO: asimo>This function should be used instead the old get_publish_link and get_deprecate_link * * @param array params * @return string the moderate link */ function get_moderation_link($params) { global $admin_url; $redirect_to = $params['redirect_to']; $new_status = $params['status']; $action = $params['action']; $glue = $params['glue']; $status_param = $action == 'publish' ? 'publish_status' : 'comment_status'; $r = $params['before']; $r .= '<a href="' . $admin_url . '?ctrl=comments' . $glue . 'action=' . $action . $glue . $status_param . '=' . $new_status . $glue . 'comment_ID=' . $this->ID . '&' . url_crumb('comment'); if ($params['save_context']) { if ($redirect_to != NULL) { $r .= $glue . 'redirect_to=' . $redirect_to; } else { $r .= $glue . 'redirect_to=' . rawurlencode(regenerate_url('', 'filter=restore', '', '&')); } } $r .= '"'; if ($params['ajax_button']) { if ($params['save_context'] && $redirect_to == NULL) { $redirect_to = regenerate_url('', 'filter=restore', '', '&'); } $comment_type = $this->is_meta() ? 'meta' : 'feedback'; $r .= ' onclick="setCommentStatus(' . $this->ID . ', \'' . $new_status . '\', \'' . request_from() . '\', \'' . $redirect_to . '\' ); return false;"'; } $status_title = get_visibility_statuses('moderation-titles'); $r .= ' title="' . $status_title[$new_status] . '"'; if (!empty($params['class'])) { $r .= ' class="' . $params['class'] . '"'; } $r .= '>' . $params['text'] . '</a>'; $r .= $params['after']; return $r; }
/** * Display a page link of the comments on item full view * * @param integer the item id * @param string link text * @param integer the page number */ function echo_comment_pagenumber($item_ID, $text, $page, $params = array()) { $params = array_merge(array('page_before' => ' ', 'page_after' => ''), $params); global $blog, $admin_url; $page_param = $page > 1 ? '&currentpage=' . $page : ''; $comment_type = get_param('comment_type'); $page_param .= $comment_type == 'meta' ? '&comment_type=meta' : ''; echo $params['page_before'] . '<a href="' . url_add_param($admin_url, 'ctrl=items&blog=' . $blog . '&p=' . $item_ID . $page_param . '#comments') . '" onclick="startRefreshComments( \'' . request_from() . '\', ' . $item_ID . ', ' . $page . ', \'' . $comment_type . '\' ); return false;">' . $text . '</a>' . $params['page_after']; }
// Files: echo '<div class="bPostAttachments">'; // TODO /** * Needed by file display funcs * @var Item */ global $LinkOwner; $LinkOwner = new LinkItem($Item); require $inc_path . 'links/views/_link_list.inc.php'; echo '</div>'; } // ---------- comments ---------- // Actions "Recycle bin" and "Refresh" echo '<div class="feedback-actions">'; echo action_icon(T_('Refresh comment list'), 'refresh', url_add_param($admin_url, 'ctrl=items&blog=' . $blog . '&p=' . $Item->ID . '#comments'), ' ' . T_('Refresh'), 3, 4, array('onclick' => 'startRefreshComments( \'' . request_from() . '\', ' . $Item->ID . ', 1, \'' . $comment_type . '\' ); return false;', 'class' => 'btn btn-default')); if ($comment_type != 'meta') { // Don't display "Recycle bin" link for meta comments, because they are deleted directly without recycle bin echo get_opentrash_link(true, false, array('before' => ' <span id="recycle_bin">', 'after' => '</span>', 'class' => 'btn btn-default')); } echo '</div>'; if ($current_User->check_perm('meta_comment', 'view', false, $Item)) { // Display tabs to switch between user and meta comments Only if current user can views meta comments $switch_comment_type_url = $admin_url . '?ctrl=items&blog=' . $blog . '&p=' . $Item->ID; $metas_count = generic_ctp_number($Item->ID, 'metas', 'total'); $switch_comment_type_tabs = array('feedback' => array('url' => $switch_comment_type_url . '&comment_type=feedback#comments', 'title' => T_('User comments') . ' <span class="badge">' . generic_ctp_number($Item->ID, 'feedbacks', 'total') . '</span>'), 'meta' => array('url' => $switch_comment_type_url . '&comment_type=meta#comments', 'title' => T_('Meta discussion') . ' <span class="badge' . ($metas_count > 0 ? ' badge-important' : '') . '">' . $metas_count . '</span>')); ?> <div class="feedback-tabs btn-group"> <?php foreach ($switch_comment_type_tabs as $comment_tab_type => $comment_tab) { echo '<a href="' . $comment_tab['url'] . '" class="btn' . ($comment_type == $comment_tab_type ? ' btn-primary' : ' btn-default') . '">' . $comment_tab['title'] . '</a>';
} jQuery.ajax({ type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: { 'blogid': '<?php echo $Blog->ID; ?> ', 'action': 'refresh_comments', 'request_from': '<?php echo request_from(); ?> ', 'itemid': item_id, 'statuses': statuses, 'expiry_status': expiry_status, 'currentpage': currentpage, 'comment_type': comment_type }, success: function(result) { endRefreshComments( ajax_debug_clear( result ) ); show_modifieds(); }, error: function(msg) {