Gabor,

great work on new interface and D6! I suggest to implement a sort() on modules' releases' select lists (descending). Its now loaded directly from database but new versions are always placed at the bottom, regardless the name.

regards,

massa

CommentFileSizeAuthor
#5 release-ordering.patch1.13 KBgábor hojtsy

Comments

gábor hojtsy’s picture

Status: Active » Postponed (maintainer needs more info)

You mean to sort() for the filter form dropdown or elsewhere (too)?

brmassa’s picture

Gabor,

yes. Im running the module for a while. At the time i installed it, Drupal 6 was 6.2. Now that 6.5 is there, the list is all mixed coz this release was placed at the end of the list among other D5 releases.

But i believe the similar select box appears in other places, like "export translation" page. It might be a good call to create a function like "project_release_get()" in order to centralise this.

regards,

massa

gábor hojtsy’s picture

Status: Postponed (maintainer needs more info) » Active

http://drupal.org/node/322229 marked as duplicate of this one.

gábor hojtsy’s picture

Well, I was looking into the code for an easy fix, but found that the translation page filter form or the export form as shown on the above mentioned issue reuses our release listing function, which does order by the release title (= the visible name). The use of that in our export code for example is:

// The function in l10n_community.module
function l10n_community_get_releases($uri, $parsed_only = TRUE) {
  $releases = array();
  $query = "SELECT r.* FROM {l10n_community_release} r LEFT JOIN {l10n_community_project} p ON r.pid = p.pid WHERE p.uri = '%s' ORDER BY r.title";
  if ($parsed_only) {
    $query .= ' AND r.last_parsed > 0';
  }
  $result = db_query($query, $uri);
  while ($release = db_fetch_object($result)) {
    $releases[$release->rid] = $release;
  }
  return $releases;
}

    // Its use in export.inc:
    $releases = l10n_community_get_releases($uri);
    $release_options = array('all' => t('All'));
    foreach ($releases as $rid => $this_release) {
      $release_options[$rid] = $this_release->title;
    }
    $form['data']['release'] = array(
      '#title' => t('Release'),
      '#type' => count($release_options) <= 3 ? 'radios' : 'select',
      '#options' => $release_options,
      '#default_value' => isset($release) ? $release : 'all',
      '#description' => t('Exporting with all releases is useful for translators, but is not optimal to use for end users because unused data would clutter up their database, when files get imported. Export for all releases if you would like to provide a complete translation, and you work with a desktop tool.'),
    );

It could be that because the array is numbered, it is ordered by the number (in the array), and not the title. Whether this already happens in l10n_community_get_releases() or later then that in our form code would be good to know. Can someone bring this forward from here and find out the underlying reasons? I am a bit out of time at this moment, but would love to fix this bug sooner then later.

gábor hojtsy’s picture

Status: Active » Fixed
StatusFileSize
new1.13 KB

He, this was funny. On a closer look, you can see that the directive of the ORDER BY is changed if only parsed requests should be returned, which is silly. We should expand on the condition of the SELECT instead. This patch fixed it, comitted to 6.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.