--- W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1/fivestarextra/fivestarextra.admin.inc Mon Oct 27 08:34:28 2008 +++ W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1 patched/fivestarextra/fivestarextra.admin.inc Thu Sep 02 16:12:23 2010 @@ -267,6 +267,14 @@ '#title' => t('Enable Fivestar rating on users'), '#default_value' => variable_get('fivestarextra_enable_user', 0), '#return_value' => 1, + '#weight' => -6, + ); + + $form['fivestar']['fivestar_section_title'] = array( + '#type' => 'textfield', + '#title' => t('Section title'), + '#description' => t('Indicate what you want the title of the section to be on the user profile page.'), + '#default_value' => variable_get('fivestarextra_section_title_user', t('User Rating')), '#weight' => -5, ); @@ -325,7 +333,7 @@ '#type' => 'fieldset', '#title' => t('Direct rating widget'), '#collapsible' => FALSE, - '#description' => t('These settings allow you to display a rating widget to your users while they are viewing content of this type. Rating will immediately register a vote for that piece of content.'), + '#description' => t('These settings allow you to display a rating widget to your users while they are viewing users. Rating will immediately register a vote for that user.'), '#weight' => 2, ); @@ -409,6 +417,21 @@ $form['fivestar']['direct']['fivestar_direct_preview']['#value'] = theme('fivestar_preview_wrapper', $form['fivestar']['direct']['fivestar_direct_preview']['#value']); } + $form['fivestar_axes'] = array( + '#type' => 'textarea', + '#title' => t('Multiple Axes'), + '#description' => t('If you wish to rate users on more than one axes/dimension, + enter the axes here separated by commas. Leave blank or use + the single word "vote" (without the quotation marks) to + use the default single axis (vote). Note that if you change + this, such as removing an axis or changing its spelling, you + will loose ratings. For multiple axes, the "vote" axis will be + labelled "Overall" on rendering. Axes will appear in the order + given here. Changing the order will not cause loss of ratings.'), + '#rows' => 2, + '#default_value' => variable_get('fivestarextra_axes_user', 'vote'), + ); + $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), @@ -427,7 +450,7 @@ variable_set('fivestarextra_enable_user',$form_state['values']['fivestar']); - $variables = array('stars','labels_enable','style','text','title','unvote','feedback','position'); + $variables = array('stars','labels_enable','style','text','title','unvote','feedback','position','axes','section_title'); foreach ($variables as $variable) { variable_set('fivestarextra_'.$variable .'_user',$form_state['values']['fivestar_'.$variable]); } --- W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1/fivestarextra/fivestarextra.install Sun Oct 26 14:53:52 2008 +++ W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1 patched/fivestarextra/fivestarextra.install Thu Sep 02 12:53:20 2010 @@ -6,9 +6,8 @@ */ function fivestarextraextra_uninstall() { //Get rid of our variables - $variables = array('fivestarextra_stars','fivestarextra_labels_enable','fivestarextra_style','fivestarextra_text','fivestarextra_title','fivestarextra_unvote','fivestarextra_feedback','fivestarextra_position','fivestarextra_labels','fivestarextra_enable'); - foreach ($variables as $variable) { - variable_del($variable .'_comment'); - variable_del($variable .'_user'); + $variables = db_query( "SELECT name FROM {variable} WHERE name LIKE 'fivestarextra_%'" ); + while ( $variable = db_result( $variables ) ) { + variable_del($variable); }; } --- W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1/fivestarextra/fivestarextra.module Sat Aug 29 17:24:36 2009 +++ W:/ClearlyByDesign/Drupal/modules/6.x/fivestarextra/6.x-1.1 patched/fivestarextra/fivestarextra.module Thu Sep 02 16:12:23 2010 @@ -111,7 +111,7 @@ } } if (strpos($form_id, 'fivestarextra_form_user_') !== FALSE) { - if ($form_id == 'fivestarextra_form_user_'. $args[1]) { + if ($form_id == 'fivestarextra_form_user_'. $args[1] . '_' . $args[3]) { $forms[$form_id] = array('callback' => 'fivestarextra_widget_form'); return $forms; } @@ -122,11 +122,11 @@ /** * Modified version of fivestar_form for comments and users. */ -function fivestarextra_widget_form(&$form_state, $content_type, $content_id) { +function fivestarextra_widget_form(&$form_state, $content_type, $content_id, $tag = 'vote') { global $user; - $votes = fivestar_get_votes($content_type, $content_id); + $votes = fivestar_get_votes($content_type, $content_id, $tag); $values = array( 'user' => isset($votes['user']['value']) ? $votes['user']['value'] : NULL, @@ -141,7 +141,7 @@ 'text' => variable_get('fivestarextra_text_'. $content_type, 'dual'), 'content_type' => $content_type, 'content_id' => $content_id, - 'tag' => 'vote', + 'tag' => $tag, 'autosubmit' => TRUE, 'title' => variable_get('fivestarextra_title_'. $content_type, 1) ? NULL : FALSE, 'feedback_enable' => variable_get('fivestarextra_feedback_'. $content_type, 1), @@ -186,29 +186,58 @@ global $user; switch ($op) { case 'view': - if (variable_get('fivestarextra_enable_user', FALSE)) { + if ( variable_get('fivestarextra_enable_user', FALSE) && + ( $weight = variable_get('fivestarextra_position_user', '100') ) != 'hidden' ) { //Return the category $account->content['fivestarextra'] = array( '#type' => 'user_profile_category', - '#title' => t('User Rating'), - '#weight' => variable_get('fivestarextra_position_user', '100'), + '#title' => t(variable_get('fivestarextra_section_title_user', 'User Rating')), + '#weight' => $weight, + '#attributes' => array( 'class' => 'user-ratings' . ( $user->uid == $account->uid ? ' user-ratings-own-profile' : '' ), ), ); - if ($user->uid == $account->uid) { - //If the user is viewing their own page, return a static form so they cannot vote - $account->content['fivestarextra']['widget'] = array( - '#type' => 'user_profile_item', - '#title' => t('Your Rating:'), - '#value' => fivestar_static('user', $account->uid), - ); - } - else { - //If it is not their own profile page, return the normal fivestar widget - $account->content['fivestarextra']['widget'] = array( - '#type' => 'user_profile_item', - '#title' => t('Rate %username:', array('%username' => $account->name)), - '#value' => drupal_get_form('fivestarextra_form_user_'. $account->uid, 'user', $account->uid), - ); + $axes = explode( ',', variable_get( 'fivestarextra_axes_user', 'vote' ) ); + $number_of_axes = count($axes); + $inner_weight = 0; + foreach ( $axes as $tag ) { + $form_tag = strtolower( trim( preg_replace( '/\W+/', '_', $tag ), '_' ) ); + $class_tag = str_replace( '_', '-', $form_tag ); + switch ($inner_weight) { + case 0 : + $class_tag .= ' user-ratings-first'; + break; + case $number_of_axes-1 : + $class_tag .= ' user-ratings-last'; + break; + } + if ($user->uid == $account->uid) { + //If the user is viewing their own page, return a static form so they cannot vote + $account->content['fivestarextra']['widget_'.$form_tag] = array( + '#type' => 'user_profile_item', + '#title' => t('Your !tag Rating:', array( '!tag' => $number_of_axes > 1 ? ($tag=='vote' ? t('Overall') : $tag) : '', ) ), + '#value' => fivestar_static('user', $account->uid, $tag), + '#weight' => $inner_weight++, + '#attributes' => array( 'class' => 'user-ratings-'.$class_tag, ), + ); + } + else { + //If it is not their own profile page, return the normal fivestar widget + $account->content['fivestarextra']['widget_'.$form_tag] = array( + '#type' => 'user_profile_item', + '#title' => t('Rate %username!on:', array( + '%username' => $account->name, + '!on' => ( $number_of_axes == 1 + ? '' + : ( $tag == 'vote' + ? t( ' overall' ) + : t( ' on !tag', array( '!tag' => $tag, ) ) ) ), + ) + ), + '#value' => drupal_get_form('fivestarextra_form_user_'. $account->uid . '_' . $form_tag, 'user', $account->uid, $tag, $form_tag ), + '#weight' => $inner_weight++, + '#attributes' => array( 'class' => 'user-ratings-'.$class_tag, ), + ); + } } } break;