Skip to end of metadata
Go to start of metadata


Configuration

Accessing the admin screen


Admin screen is available at: <Base Url>/admin/acv/viewglobalconfiguration.action

Enabling Features

By default the plugin features are disabled, to enable:



Space configuration is available from the space administration screen when Space Controlled voting is enabled.

How the voting scores are applied

The Content Voting plugin works by applying the voting score to the last editor of a page, which if no-one else has edited the page is the original content author.

Adding macros to layouts

Layouts Using Theme Builder

In Confluence Administration > Theme Builder > Layouts, add this code to the 'Footnotes' panel, just before the {builder-comments} macro:

{content-voting-controls} 
{voting-user-threshold} 

Layouts Using Confluence Themes

Comments Layout Using Confluence Themes

Edit page layout:

In Confluence Administration > Look and Feel > Layouts > Content Layouts > Create Custom, replace the whole 'Comment' layout with the contents of the text file listed for your Confluence version:

Page Layout Using Confluence Themes

Edit page layout:

In Confluence Administration > Look and Feel > Layouts > Content Layouts > Create Custom, replace the whole 'Page' layout with the contents of the text file listed for your Confluence version:


Top of page

Macro Parameters

{content-voting-user-score}

This macro shows the score for an individual.

Parameter

Default

Description

Required

aggregate

true

Set to false to show a break down of up and down scores

?

username

Current User

The username to display the score for

?

 

{content-voting-controls}

Places the the voting controls on a page, comment or blog post. This macro is designed to be used as part of a custom layout but can be placed on any pages, comment, blog post or user profile.

 
{voting-user-threshold}

Places the comment threshold on a page. This macro is designed to be used as part of a custom layout to show and hide comments with particular thresholds.


Searching

User scores

Search Field

Example Usage

Example Description

acvUserVotes

acvUserVotes:[DEVI:1 TO 40000000]

show all users that have a score of 1-40000000

acvUserVotesUp

acvUserVotesUp:[DEVI:50-100]

shows all users with between 50 and 100 up votes

acvUserVotesDown

acvUserVotesDown:[DEVI:100-400000]

shows all users with move than 100 down votes

acvOwner

acvOwner:jmort

shows all content that contributes to the jmort user's score

Content Scores

Search Field

Example Usage

Example Description

acvVotes

acvVotes:[DEVI:1-400000]

shows all content that has greater than 1 score

acvVotesUp

acvVotesUp:[DEVI:100-40000]

shows all content with more than 100 up votes

acvVotesDown

acvVotesDown:[DEVI:50-100]

shows all content with between 50 and 100 down votes

Rebuilding Scores

If scores get out of sync then running a re-index will fix any issues with votes that have been applied to content.

Scores can be rebuilt by visiting: <Base Url>/admin/acv/viewrebuildvotes.action

If vote logging is enabled each vote will be logged in <CONFLUENCE_HOME>/logs/content-voting.log. This file can be used to reapply all the votes cast to the content in a batch job. This can be useful for testing and recovering from a failure. On a cluster each log file should be uploaded as each cluster logs the votes that are directed at it. On the first file "Reset Content Vote Scores" should be selected to set all scores to 0 and on subsequent files it should be un-checked so that the previous scores are not removed.

It's recommended to rebuild indexes after upgrading the plugin to newer versions.

Top of page

Recipes

Replacing the Thumb voting images with CSS

You can replace the thumb images with your own using CSS. The plugin has specific classes around the voting controls to enable this. You can change either the page voting control images, the comment voting control images or both.
Some example CSS which replaces just the comment voting control images only is as follows:

span.acv-comment a.acv-up img, span.acv-comment a.acv-down img {
  display: none;
}
span.acv-comment a.acv-up { background-image: url('http://path.to/image.ext'); background-repeat: no-repeat; }
span.acv-comment a.acv-down { background-image: url('http://path.to/another-image.ext'); background-repeat: no-repeat; }


You can repeat the same using span.acv-page to change those for the page too.

Example Advanced Search Configuration

The following advanced search configuration searches for the top voted content in the site and sorts it highest to lowest showing the score, up, down votes and the owner of the content (the user which collects the score of the document)

<config id="content_vote" title="Top Content"> 
<scripts> 
<preSearch> 
    <![CDATA[ 
    from org.apache.lucene.search import BooleanClause 
    labelSubQuery = searcher.buildStandardQuery(["acvVotes"], "[1 TO 40000000]")
    bean.getLuceneQuery().add( labelSubQuery, BooleanClause.Occur.MUST )
    ]]> 
</preSearch> 
</scripts> 
<query> 
<sort> 
        <sortField reverse="true">acvVotes</sortField> 
</sort> 
<retrieveAllResults>false</retrieveAllResults> 
</query> 
<output> 
<columns> 
        <column title="Title" renderer="ceo-title" /> 
        <column title="Score" renderer="text" field="acvVotes" />
        <column title="Votes Up" renderer="text" field="acvVotesUp" />
        <column title="Votes Down" renderer="text" field="acvVotesDown" />
        <column title="Document Owner" renderer="text" field="acvOwner" />
</columns> 
<template> 
<![CDATA[ 
<table class="confluenceTable">
  <thead>
    <tr>
    #foreach ($column in $bean.columns)
      <th class="confluenceTh">$column.title</th>
    #end
    </tr>
  </thead>
  <tbody>
  ## Extract the renderers for this display
      #set($columnCount = 0)
      #foreach($column in $bean.columns)
        #foreach ($column in $bean.columns)
            #set($veloCount = $velocityCount - 1)
            #if($columnCount == $veloCount)
                $columnRenderers.add($columnCount, $column.renderer)
                $columnParams.add($columnCount, $column.params)
            #end
        #end
        #set($columnCount = $columnCount + 1)
      #end

#if ($bean.getPaginationSupport().getItems() && $bean.getPaginationSupport().getPage().size() > 0)
        #foreach ($result in $bean.getPaginationSupport().getPage())
          <tr>
            #foreach($columnRenderer in $columnRenderers)
                <td class="confluenceTd">
                  #set($colCount = $velocityCount - 1)
                  $columnRenderer.renderField($result, $columnParams.get($colCount), $bean)
                </td>
            #end
          </tr>
        #end

      #else
      <tr>
        <td colspan="$bean.columns.size()">
          There were no results for your search criteria.
        </td>
      </tr>
      #end
  </tbody>
</table>
#set($pageId = $bean.entityId)
#pagination( $bean.paginationSupport "viewpage.action?pageId=$pageId$searchParams" )
    
 
  ]]> 
</template> 
</output> 
</config>

 

Top of page

 

  • No labels