diff -r 21dfca16e703 priorities.module
--- a/priorities.module	Thu Aug 18 16:57:04 2011 +0200
+++ b/priorities.module	Thu Aug 18 20:42:00 2011 +0200
@@ -34,7 +34,7 @@ function priorities_survey_status($statu
 }
 
 /**
- * Label for survey showbefore. // ***EC***
+ * Label for survey showbefore.
  */
 function priorities_survey_showbefore($showbefore = NULL) {
   $priorities_survey_showbefore = array(
@@ -50,7 +50,7 @@ function priorities_survey_showbefore($s
 }
 
 /**
- * Label for survey modify. // ***EC***
+ * Label for survey modify.
  */
 function priorities_survey_modify($modify = NULL) {
   $priorities_survey_modify = array(
@@ -66,9 +66,12 @@ function priorities_survey_modify($modif
 }
 
 /**
- * Label for survey anonymous voting. // ***EC*** TODO Add the ability to filter by cookie.
+ * Label for survey anonymous voting.
  */
 function priorities_survey_anonymous($anonymous = NULL) {
+  // Adding a "filter by cookie" is no longer a good idea
+  // due to the change in the european regulation about cookie.
+  // TODO add a refrence to the thread on drupal.org. 
   $priorities_survey_anonymous = array(
     t('not allowed'),
     t('allowed, filtered by user IP'),
@@ -82,7 +85,7 @@ function priorities_survey_anonymous($an
 }
 
 /**
- * Values for survey duration. // ***EC***
+ * Values for survey duration.
  */
 function priorities_survey_duration($duration = NULL) {
   $priorities_survey_duration = array(
@@ -107,7 +110,7 @@ function priorities_survey_duration($dur
 }
 
 /**
- * Label for survey display. // ***EC***
+ * Label for survey display.
  */
 function priorities_survey_display($display = NULL) {
   $priorities_survey_display = array(
@@ -161,7 +164,7 @@ function priorities_default_priorities()
 }
 
 /**
- * Implementation of hook_cron(). // ***EC***
+ * Implementation of hook_cron().
  */
 function priorities_cron() {
   // Check for surveys due to be closed (status = 0 or status = 1).
@@ -199,9 +202,9 @@ function priorities_node_info() {
  * Implementation of hook_perm().
  */
 function priorities_perm() {
-  /* ***EC*** As a counterpart of the new "showbefore" setting, we must add a new perm
-   * to allow some users to see the results of a given survey or all surveys even if "showbefore" is not allowed
-   * and if they haven't set their priorities. */
+  // As a counterpart of the new "showbefore" setting, we must add a new perm
+  // to allow some users to see the results of a given survey or all surveys even if 'showbefore' is not allowed
+  // and if they haven't set their priorities.
   $perms = array(
     'administer priorities',
     'create priorities_alternative nodes',
@@ -439,7 +442,6 @@ function priorities_theme() {
 /**
  * Delete menu entries.
  */
-
 function priorities_delete_menus($this_survey = NULL) {
   $where = isset($this_survey) ? "ml.link_path = 'priorities/" . $this_survey['survey_name'] . "/set'" : "ml.link_path = 'priorities/%/set'";
   $result = db_query("SELECT mlid FROM {menu_links} ml WHERE $where");
@@ -514,6 +516,7 @@ function priorities_build_menus($this_su
       }
     }
   }
+
   menu_cache_clear_all();
 }
 
@@ -534,11 +537,9 @@ function priorities_survey_load($survey_
  */
 function priorities_titles($op = 'title', $survey = NULL) {
   if ($op == 'results') {
-    // ***EC*** We make this less confusing with "()" instead of one "-".
     return $survey['title'] . ' (' . variable_get('priorities_results_title', t('Get results for this survey')) . ')';
   }
   elseif ($op == 'set') {
-    // ***EC*** We make this less confusing with "()" instead of one "-".
     return $survey['title'] . ' (' . variable_get('priorities_set_title', t('Set priorities to answer this survey')) .')';
   }
   else {
@@ -572,6 +573,7 @@ function priorities_settings_overview_pa
     }
     $output .= '</ul>';
   }
+
   return $output;
 }
 
@@ -592,7 +594,6 @@ function priorities_edit_priorities(&$fo
     );
   }
   else {
-    // ***EC*** Let's add the new settings: 'showbefore', 'modify', 'anonymous', 'starttime', 'duration', 'display'.
     $survey = array('survey_name' => '', 'title' => '', 'description' => '', 'sorted' => 1, 'status' => 1, 'showbefore' => 1, 'modify' => 1, 'anonymous' => 0, 'starttime' => 0, 'duration' => 0, 'display' => 0, 'nodetype' => 'priorities_alternative');
     $form['survey_name'] = array(
       '#type' => 'textfield',
@@ -618,7 +619,6 @@ function priorities_edit_priorities(&$fo
     '#required' => FALSE,
   );
 
-  // ***EC*** We add the ability to let the user sets the filter_format for the survey's description.
   $form['tips'] =  filter_form($survey['format']);
 
   $form['status'] = array(
@@ -629,7 +629,6 @@ function priorities_edit_priorities(&$fo
     '#options' => priorities_survey_status(),
     '#description' => t('When a survey is <em>public</em>, authorized users can answer to the survey and see its on-going results. When a survey is  <em>active</em>, authorized users can only answer the survey. When a survey is <em>closed</em>, authorized users can only see its results. When a survey is <em>disabled</em>, users cannot answer the survey, nor see its results.'), 
   );
-  // ***EC*** Add the 'showbefore' setting for each survey.
   $form['showbefore'] = array(
     '#type' => 'radios',
     '#title' => t('Show results before voting'),
@@ -638,7 +637,6 @@ function priorities_edit_priorities(&$fo
     '#options' => priorities_survey_showbefore(),
     '#description' => t('Allow or disallow users to see the results of the survey before voting (<em>this setting works only when the status of the survey is set to public</em>). This setting can be <em>bypassed</em> by a role based permission.')
   );
-  // ***EC*** Add the 'modify' setting for each survey.
   $form['modify'] = array(
     '#type' => 'radios',
     '#title' => t('Modify previous vote'),
@@ -647,7 +645,6 @@ function priorities_edit_priorities(&$fo
     '#options' => priorities_survey_modify(),
     '#description' => t('Allow or disallow the ability to modify a previous vote.')
   );
-  // ***EC*** Add the 'anonymous' voting setting for each survey.
   $form['anonymous'] = array(
     '#type' => 'radios',
     '#title' => t('Anonymous voting'),
@@ -656,7 +653,6 @@ function priorities_edit_priorities(&$fo
     '#options' => priorities_survey_anonymous(),
     '#description' => t('Allow or disallow anonymous voting on this survey. Filtering by user IP ensures only one vote is allowed per user IP.')
   );
-  // ***EC*** Add the 'starttime' setting for each survey.
   $form['starttime'] = array(
     '#type' => 'textfield',
     '#title' => t('Start time'),
@@ -666,7 +662,6 @@ function priorities_edit_priorities(&$fo
     '#required' => FALSE,
     '#description' => t('This is the start time (in seconds) from which the duration of the survey will be calculated. 0 = <em>never</em>. If you want to start from now, just copy the number inside the following brackets [ ') . time() . t(' ]. Alternatively you can also set a date in the past or in the future. You need to add or to substract the corresponding duration in seconds. For example, 7 days in the future from now will be: (60 * 60 * 24 * 7) + ') . time() . t(', and one month before now should be: ') . time() . t(' - (60 * 60 * 24 * 30).'),
   );
-  // ***EC*** Add the 'duration' setting for each survey.
   $form['duration'] = array(
     '#type' => 'select',
     '#title' => t('Duration'),
@@ -675,7 +670,6 @@ function priorities_edit_priorities(&$fo
     '#options' => priorities_survey_duration(),
     '#description' => t('After this period in seconds from the <em>Start time</em> above, the survey will go from <em>public</em> or <em>active</em> to <em>closed</em> automatically.'),
   );
-  // ***EC*** Add the 'display' setting for each survey.
   $form['display'] = array(
     '#type' => 'radios',
     '#title' => t('Display'),
@@ -849,7 +843,6 @@ function priorities_edit_priorities_subm
     $survey['survey_name'] = 'priorities-' . $survey['survey_name'];
 
     // Store into database.
-    // ***EC*** Add the new settings: 'format', 'showbefore', 'modify', 'anonymous', 'starttime', 'duration', 'display'.
     db_query("INSERT INTO {priorities_surveys} (survey_name, title, description, format, sorted, status, showbefore, starttime, duration, anonymous, modify, display, nodetype, tid) VALUES ('%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', %d)", $survey['survey_name'], $survey['title'], $survey['description'], $survey['format'], $survey['sorted'], $survey['status'], $survey['showbefore'], $survey['modify'], $survey['anonymous'], $survey['starttime'], $survey['duration'], $survey['display'], $survey['nodetype'], $tid);
 
     // Add the new survey to the menu.
@@ -880,7 +873,6 @@ function priorities_edit_priorities_subm
       priorities_build_menus($survey);
     }
 
-    //***EC*** Add the new settings: 'format', 'showbefore', 'modify', 'anonymous', 'starttime, 'duration', 'display'.
     db_query("UPDATE {priorities_surveys} SET title = '%s', description = '%s', format = %d, sorted = %d, status = %d, showbefore = %d, modify = %d , anonymous = %d, starttime = %d, duration = %d, display = %d, nodetype = '%s', tid = %d WHERE survey_name = '%s'", $survey['title'], $survey['description'], $survey['format'], $survey['sorted'], $survey['status'], $survey['showbefore'], $survey['modify'], $survey['anonymous'], $survey['starttime'], $survey['duration'], $survey['display'], $survey['nodetype'], $tid, $survey['survey_name']);
   }
 
@@ -888,7 +880,7 @@ function priorities_edit_priorities_subm
 }
 
 /**
- * Menu callback; Build the form presenting priorities configuration options.
+ * Menu callback; build the form presenting priorities configuration options.
  */
 function priorities_configure() {
   drupal_add_css(drupal_get_path('module', 'priorities') . '/priorities.css', 'module', 'all', TRUE);
@@ -1056,6 +1048,7 @@ function priorities_configure() {
 
   priorities_delete_menus();
   priorities_build_menus();
+
   return system_settings_form($form);
 }
 
@@ -1081,20 +1074,17 @@ function priorities_get_surveys($gid = N
  * Build the main page for a given survey.
  */
 function priorities_get_set_priorities($survey) {
-  global $user; //***EC*** We need this in order to check the user_access.
+  global $user;
 
   $output = '';
-
-  // ***EC*** Use drupal message instead of form for consistency and return.
   if ($survey['status'] == 3) {
     drupal_set_message(t('Sorry, this survey is disabled, you cannot set priorities anymore, nor see its results.') . l(t(' Back to the surveys list'), 'priorities') . '.', 'warning', FALSE);
     return $output;
   }
   else {
-    // ***EC*** If available we add the description of the survey and we use the filter chosen by user instead of the default one.
+    // If available we add the description of the survey
+    // and we use the filter chosen by user instead of the default one.
     $output .= '<div id="priorities-description">' . (empty($survey['description']) ? '' : check_markup($survey['description'], $survey['format'], FALSE)) . '</div>';
-
-    // ***EC*** Add an unordered list instead of an html list. OK this is mostly cosmetic!
     $output .= '<ul>';
     if ($survey['status'] < 2 && priorities_set_access($survey)) {
       $output .= '<li>' . l(variable_get('priorities_set_title', t('Set priorities to answer this survey')), 'priorities/' . $survey['survey_name'] . '/set') . '</li>';
@@ -1104,23 +1094,20 @@ function priorities_get_set_priorities($
     }
   }
 
-  // ***EC*** If the user can edit this survey, then we add a link here for convenience.
   if (user_access('administer priorities')) {
     $output .= '<li>' . l('Edit this survey', 'admin/settings/priorities/' . $survey['survey_name']) . '</li>';
   }
-  $output .= '</ul>'; //***EC*** End of the unordered list.
-
-  // ***EC*** For convenience we add a link to the surveys list.
+  $output .= '</ul>';
   $output .= l(t('Back to the surveys list'), 'priorities');
 
   return $output;
 }
 
 /**
- * Helper function to retrieve user's priorities if any because we will use it twice. ***EC***
- * TODO Add the ability to filter by cookie.
+ * Helper function to retrieve user's priorities if any.
  */
 function priorities_get_user_priorities($survey) {
+  // For filtering by cookie, see comments in function priorities_survey_anonymous().
   global $user;
 
   // We need the IP of the user for anonymous voting.
@@ -1139,6 +1126,7 @@ function priorities_get_user_priorities(
   while ($result = db_fetch_array($results)) {
     $user_priorities[$result['nid']] = $result['eval'];
   }
+
   return $user_priorities;
 }
 
@@ -1150,30 +1138,29 @@ function priorities_set_priorities(&$for
   drupal_add_css(drupal_get_path('module', 'priorities') . '/priorities.css', 'module', 'all', TRUE);
   global $user;
 
-  // ***EC*** Load the necessary js to display a collapsible fieldset only if necessary.
+  // Load the necessary js to display a collapsible fieldset only if necessary.
   if ($survey['display'] == 1) {
     drupal_add_js('misc/drupal.js', 'core');
     drupal_add_js('misc/collapse.js', 'core');
   }
 
-  // Do not allow to set priorities on closed or disabled surveys. ***EC*** Use drupal message for consistency and return. 
+  // Do not allow to set priorities on closed or disabled surveys.
   if ($survey['status'] > 1) {
     drupal_set_message(t('Sorry! This survey is now closed, you cannot set priorities anymore.') . l(t('Back to the surveys list'), 'priorities') . '.', 'warning', FALSE);
     return $form;
   }
 
-  // ***EC*** Check whether user is not connected or if anonymous voting is not allowed (0).
+  // Check whether a user is not connected or if anonymous voting is not allowed (0).
   if (!$user->uid && $survey['anonymous'] == 0) {
     global $base_url;
     drupal_set_message(t('Anonymous voting is not allowed. You have to be logged in to answer the survey. Please, ') . ' <a href="' . $base_url . '/user?' . drupal_get_destination() . '">' . t('login') . '</a>' . t(' or '). '<a href="' . $base_url . '/user/register?' . drupal_get_destination() . '">'. t('register') . '</a>.', 'warning');
   }
   else {
     // Retrieve user's priorities if any.
-    // ***EC*** We use here the new function.
     $user_priorities = priorities_get_user_priorities($survey);
 
     if (!empty($user_priorities)) {
-      // ***EC*** Do not allow to modify a previous vote if 'modify' is set to not allowed (0).
+      // Do not allow to modify a previous vote if 'modify' is set to not allowed (0).
       if ($survey['modify'] == 0) {
         if ($survey['status'] == 0) {
           drupal_set_message(t('Sorry! You have already set priorities for this survey and the modification of previous priorities is not allowed. Find below your previous choice or ' . l(t('view the results'), 'priorities/' . $survey['survey_name'] . '/results') . '.'), 'warning', FALSE);
@@ -1194,8 +1181,7 @@ function priorities_set_priorities(&$for
   }
 
   // Display nodes and form controls.
-  // ***EC*** And let's use the filter chosen by the user instead of the default one.
-  // ***EC*** And add an extra line for better display.
+  // And let's use the filter chosen by the user instead of the default one.
   $form['description'] = array(
     '#value' => '<div id="priorities-description">' . (empty($survey['description']) ? '' : check_markup($survey['description'], $survey['format'], FALSE)) . '</div><br />'
   );
@@ -1220,13 +1206,13 @@ function priorities_set_priorities(&$for
     // Skip nodes with wrong nodetype.
     if ($node->type != $eval_nodetype) continue;
 
-    // ***EC*** Check the display type whether it is node_view (0) or the collapsible fieldset (1).
+    // Check the display type whether it is node_view (0) or the collapsible fieldset (1).
     if ($survey['display'] == 0) {
       $form['node_' . $result['nid']] = array('#value' => node_view($node, FALSE, FALSE, FALSE));
     }
     else {
       if ($node->body) {
-        // ***EC*** If we display the node->body we must use the filter chosen by the user. My mistake.
+        // If we display the node->body we must use the filter chosen by the user.
         $form['node_' . $result['nid']] = array(
           '#value' => '<h2>' . l($node->title, 'node/' . $node->nid) . '</h2>' . '<fieldset class="collapsible collapsed"><legend>' . t('Description') . '</legend>' . check_markup($node->body, $node->format, FALSE) . '</fieldset>',
         );
@@ -1262,7 +1248,8 @@ function priorities_set_priorities(&$for
     '#value' => $survey['survey_name'],
   );
 
-  // ***EC*** Display the 'submit' button only if user can set priorities or update previous ones if any.
+  // Display the 'submit' button only if user can set priorities
+  // or update previous ones if any.
   if (empty($user_priorities)) {
     if ($user->uid || $survey['anonymous'] == 1) {
       $form['submit'] = array(
@@ -1279,8 +1266,6 @@ function priorities_set_priorities(&$for
       );
     }
   }
-
-  // ***EC*** For convenience we add a link to the survey's main page.
   $form['bottom'] = array (
     '#value' => l(t('Back to the main page'), 'priorities/' . $survey['survey_name'])
   );
@@ -1289,13 +1274,15 @@ function priorities_set_priorities(&$for
 }
 
 function priorities_set_priorities_submit($form, &$form_state) {
+  // For filtering by cookie, see comments in function priorities_survey_anonymous().
   global $user;
-  // ***EC*** We need the IP address for anonymous voting.
+
+  // We need the IP address for anonymous voting.
   $hostname = $_SERVER['REMOTE_ADDR'];
 
   $survey_name = $form_state['values']['survey_name'];
 
-  // ***EC*** Let's retrieve the settings of the current survey.
+  // Let's retrieve the settings of the current survey.
   $surveys = priorities_get_surveys();
   $survey = $surveys[$survey_name];
 
@@ -1309,7 +1296,6 @@ function priorities_set_priorities_submi
         $result = db_query("SELECT eval+1 FROM {priorities} WHERE survey_name='%s' AND uid = %d AND nid = %d", $survey_name, $user->uid, $nid);
       }
       if (!$user->uid && ($survey['anonymous'] != 0)) {
-        // ***EC*** TODO Add the ability to filter by cookie.
         if ($survey['anonymous'] == 1) {
           $result = db_query("SELECT eval+1 FROM {priorities} WHERE survey_name='%s' AND hostname = '%s' AND nid = %d", $survey_name, $hostname, $nid);
         }
@@ -1321,7 +1307,6 @@ function priorities_set_priorities_submi
             db_query("UPDATE {priorities} SET eval='%s', timestamp=NOW() WHERE survey_name='%s' AND uid = %d AND nid = %d", $value, $survey_name, $user->uid, $nid);
           }
           if (!$user->uid && ($survey['anonymous'] != 0)) {
-            // ***EC*** TODO Add the ability to filter by cookie.
             if ($survey['anonymous'] == 1) {
               $result = db_query("UPDATE {priorities} SET eval='%s', timestamp=NOW() WHERE survey_name='%s' AND hostname = '%s' AND nid = %d", $value, $survey_name, $hostname, $nid);
             }
@@ -1333,7 +1318,6 @@ function priorities_set_priorities_submi
           db_query("INSERT INTO {priorities} (survey_name, uid, nid, eval) VALUES ('%s', %d, %d, '%s')", $survey_name, $user->uid, $nid, $value);
         }
         if (!$user->uid && ($survey['anonymous'] != 0)) {
-          // ***EC*** TODO Add the ability to filter by cookie.
           if ($survey['anonymous'] == '1') {
             $result = db_query("INSERT INTO {priorities} (survey_name, hostname, nid, eval) VALUES ('%s', '%s', %d, '%s')", $survey_name, $hostname, $nid, $value);
           }
@@ -1341,7 +1325,7 @@ function priorities_set_priorities_submi
       }
     }
   }
-  // ***EC*** Display a different confirmation message whether the user is connected or anonymous. We use drupal message for consistency.
+  // Display a different confirmation message whether the user is connected or anonymous.
   if ($user->uid) {
     drupal_set_message(t('Your settings have been taken into account. Thanks for your contribution.'));
   }
@@ -1436,7 +1420,7 @@ function _priorities_results($survey_nam
 function priorities_get_priorities_results($survey) {
   drupal_add_css(drupal_get_path('module', 'priorities') . '/priorities.css', 'module', 'all', TRUE);
 
-  // ***EC*** We load the necessary js to display a collapsible fieldset only if necessary.
+  // We load the necessary js to display a collapsible fieldset only if necessary.
   if ($survey['display'] == 1) {
     drupal_add_js('misc/drupal.js', 'core');
     drupal_add_js('misc/collapse.js', 'core');
@@ -1446,7 +1430,7 @@ function priorities_get_priorities_resul
   // Allow to get priorities only on public or closed surveys.
   if (in_array($survey['status'], array(0, 2))) {
 
-    // ***EC*** For public surveys we need to check if showbefore is not allowed and if the user can bypass it.
+    // For public surveys we need to check if 'showbefore' is not allowed and if the user can bypass it.
     if ($survey['status'] == 0) {
       if ($survey['showbefore'] == 0 && !(user_access('bypass showbefore not allowed for all surveys' . $survey['title']) || user_access('bypass showbefore not allowed for ' . $survey['title']))) {
         // We need to know if the user has some previous priorities we use the new fuction for this.
@@ -1459,24 +1443,21 @@ function priorities_get_priorities_resul
         }
       }
     }
-
     $output .= '<div id="priorities-results">';
-    
-    // ***EC*** Let's use the filter chosen by the user instead of the default one.
     $output .= '<div id="priorities-description">' . (empty($survey['description']) ? '' : check_markup($survey['description'], $survey['format'], FALSE)) . '</div>';
 
     $nb_votes = db_result(db_query("SELECT count(*) AS cnt FROM priorities WHERE survey_name='%s' GROUP BY nid ORDER BY cnt DESC LIMIT 1", $survey['survey_name']));
     if (!$nb_votes) { $nb_votes = '0'; }
 
-    // ***EC*** If anonymous voting is allowed let's display the number of anonymous votes.
+    // If anonymous voting is allowed let's display the number of anonymous votes.
     if ($survey['anonymous'] == 0) {
-      $output .= '<div id="priorities-nb-votes"><p><strong>' . t('Number of casted votes: ') . $nb_votes . '</strong></p></div>'; //***EC*** add strong.
+      $output .= '<div id="priorities-nb-votes"><p><strong>' . t('Number of casted votes: ') . $nb_votes . '</strong></p></div>';
     }
     else {
       $nb_votes_anon = db_result(db_query("SELECT count(*) AS cnt FROM priorities WHERE survey_name='%s' AND uid=0 GROUP BY nid ORDER BY cnt DESC LIMIT 1", $survey['survey_name']));
       if (!$nb_votes_anon) { $nb_votes_anon = '0'; }
       $nb_votes_users = $nb_votes - $nb_votes_anon;
-      $output .= '<div id="priorities-nb-votes"><p><strong>' . t('Number of casted votes: ') . $nb_votes . '</strong>' . '&nbsp;('. t('Known users: ') . $nb_votes_users . '&nbsp;/&nbsp;' . t('Anonymous: ') .$nb_votes_anon . ')' . '</p></div>'; //***EC*** add strong.
+      $output .= '<div id="priorities-nb-votes"><p><strong>' . t('Number of casted votes: ') . $nb_votes . '</strong>' . '&nbsp;('. t('Known users: ') . $nb_votes_users . '&nbsp;/&nbsp;' . t('Anonymous: ') .$nb_votes_anon . ')' . '</p></div>';
     }
 
     $eval_nodetype = $survey['nodetype'];
@@ -1490,8 +1471,6 @@ function priorities_get_priorities_resul
     $results = db_query($sql);
 
     $output .= _priorities_legend();
-
-    // ***EC*** Add an extra space to separate the alternatives.
     $output .= '<br />';
 
     $nodes_to = array() ;
@@ -1508,13 +1487,14 @@ function priorities_get_priorities_resul
           $node = node_load($nodes_to[$k]['nid']);
           $node->evals = $evals[$j];
 
-          // ***EC*** Use the collapsible fieldset to display the node->body as an alternative display and only if the body is not empty.
+          // Use the collapsible fieldset to display the node->body as an alternative display
+          // and only if the body is not empty.
           if ($survey['display'] == 0) {
             $output .= node_view($node, FALSE, FALSE, FALSE);
           } else {
             $output .= '<br /><h2>' . l($node->title, 'node/' . $node->nid) . '</h2>';
             if ($node->body) {
-              // ***EC*** If we display the node->body we must use the filter chosen by the user. My mistake.
+              // If we display the node->body we must use the filter chosen by the user.
               $output .= '<fieldset class="collapsible collapsed"><legend>' . t('Description') . '</legend>' . check_markup($node->body, $node->format, FALSE) . '</fieldset>';
             }
           }
@@ -1527,19 +1507,16 @@ function priorities_get_priorities_resul
           $evals_table .= '</tr></table>';
 
           $output .= $evals_table;
-
-          // ***EC*** Add an extra space to separate the alternatives.
           $output .= '<br />';
         }
       }
     }
 
-  // ***EC*** For convenience we add a link to this survey's page.
   $output .= l(t('Back to the main page'), 'priorities/' . $survey['survey_name']);
-
   $output .= '</div>';
   }
-  // Do not allow to get priorities on active or disabled surveys. ***EC*** Let's use drupal message for consistency.
+
+  // Do not allow to get priorities on active or disabled surveys.
   else {
     drupal_set_message(t('Sorry! Results for this survey are not public. ') . l(t('Back to the main page'), 'priorities/' . $survey['survey_name']) . '.', 'warning', FALSE);
     return $output;
@@ -1579,6 +1556,7 @@ function theme_priorities_choices($form)
 
   $output = theme('table', $headers, $rows);
   $output .= drupal_render($form);
+
   return $output;
 }
 
@@ -1611,13 +1589,13 @@ function theme_priorities_radios($form) 
  * Theme a list of surveys, sorted by status.
  */
 function theme_priorities_surveys($surveys) {
-  global $user; //***EC*** We need this in order to check user_access.
+  // We need this in order to check user_access.
+  global $user;
 
   $output = '';
   // No surveys.
   if (empty($surveys)) {
     $message = '';
-    // ***EC*** As we use drupal_set_message we need to remove all <p>.
     $message .= t('No survey has yet been defined.');
     if (user_access('administer priorities')) {
       $message .= l(t(' You can create your first survey.'), 'admin/settings/priorities/add');
@@ -1625,8 +1603,8 @@ function theme_priorities_surveys($surve
     else {
       $message .= t(' Only admins with proper permission can create a survey.');
     }
-    // ***EC*** For consistency, let's use drupal_set_message.
     drupal_set_message($message, 'warning', FALSE);
+
     return $output;
   }
   else {
@@ -1646,7 +1624,6 @@ function theme_priorities_surveys($surve
             $output .= '<li>' . priorities_titles('title', $survey);
             // If the survey is disabled we shouldn't display anything but the title with no link.
             if ($status != 3) {
-              // Add a link to the survey main page and everything is put between 2 ().
               $output .= '&nbsp;- (' . l('Main page', 'priorities/' . $survey['survey_name']);
 
               // Before displaying a link we must check if the user can set priorities.
@@ -1660,7 +1637,6 @@ function theme_priorities_surveys($surve
                 $output .= l(variable_get('priorities_results_title', t('Get results for this survey')), 'priorities/' . $survey['survey_name'] .'/results');
               }
 
-              // ***EC*** If the user can edit this survey, then we add a link here for convenience.
               if (user_access('administer priorities')) {
                 $output .= '&nbsp;/ ';
                 $output .= l('Edit this survey', 'admin/settings/priorities/' . $survey['survey_name']);
@@ -1673,7 +1649,6 @@ function theme_priorities_surveys($surve
         }
       }
     }
-    // For better convenience let user with "administer priorities" permission add a new survey from this page.
     if (user_access('administer priorities')) {
       $output .= '<p>' . l(t('Add a new survey'), 'admin/settings/priorities/add') . '</p>';
     }
