Index: banner.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/banner/banner.module,v
retrieving revision 1.50
diff -u -r1.50 banner.module
--- banner.module	11 May 2005 04:34:04 -0000	1.50
+++ banner.module	19 May 2005 15:18:27 -0000
@@ -696,7 +696,7 @@
              $banner->title,
              $owner->name,
              _banner_status($banner->status),
-             $banner->position,
+             banner_group_name($banner->position),
              $banner->url,
              format_date($banner->created, 'small')
            ));
@@ -769,6 +769,15 @@
   return $output;
 }
 
+function theme_banner_groups() {
+  return range(0,9);
+}
+
+function banner_group_name($gid) {
+  $groups = theme('banner_groups');
+  return $groups[$gid];
+}
+
 function banner_form($edit = NULL) {
   $group = '';
   if ($edit['id']) {
@@ -779,7 +788,7 @@
   $group .= form_textfield(t('URL'), 'url', $edit['url'], 80, 255, t('Target URL for this banner.'));
   $group .= form_select(t('Status'), 'status', $edit['status'], _banner_status(), t('Status of banner.  A \'pending\' banner requires administrative approval before it will be displayed.  An \'enabled\' banner is approved and actively being displayed. A \'disabled\' banner is approved but disabled by the user.  A \'blocked\' banner is approved but disabled by the admin, for example after being displayed \'max views\' times.  A \'denied\' banner was not approved by the admin.'));
   $group .= form_textfield(t('Owner'), 'uid', $edit['uid'], 5, 10, t('Optional UID of site user that own this banner.  This user will be able to view banner statistics.'));
-  $group .= form_select(t('Group'), 'position', $edit['position'], range(0,9), t('Which group this banner belongs in.  Each group can be displayed in a different position on your web page, as defined by your theme.'));
+  $group .= form_select(t('Group'), 'position', $edit['position'], theme('banner_groups'), t('Which group this banner belongs in.  Each group can be displayed in a different position on your web page, as defined by your theme.'));
   $group .= form_textfield(t('Automatically publish banner'), 'publish_date', ($edit['publish_date'] ? format_date((int)$edit['publish_date']) : ''), 30, 55, t('The date at which this banner will be automatically published.  Leave empty if you don\'t want to schedule this banner, or fill out a string containing an English date format.  Example input:') . " '". date('j F Y G:i') ."', '". date('m/d/y H:i') ."', '". date('F j, Y H:i') ."', ...");
   $group .= form_textfield(t('Automatically unpublish banner'), 'unpublish_date', ($edit['unpublish_date'] ? format_date((int)$edit['unpublish_date']) : ''), 30, 55, t('The date at which this banner will be automatically unpublished.  Leave empty if you don\'t want to schedule this banner, or fill out a string containing an English date format.  Example input:') . " '". date('j F Y G:i') ."', '". date('m/d/y H:i') ."', '". date('F j, Y H:i') ."', ...");
   $form = $group;
@@ -939,7 +948,7 @@
     $row[] = _banner_status($banner->status);
     $user = user_load(array('uid' => "$banner->uid"));
     $row[] = array('data' => l($user->name, "user/$user->uid/view"), 'align' => 'center');
-    $row[] = array('data' => $banner->position, 'align' => 'center');
+    $row[] = array('data' => banner_group_name($banner->position), 'align' => 'center');
     $row[] = array('data' => $banner->views, 'align' => 'center');
     $row[] = array('data' => $banner->clicks, 'align' => 'center');
     // TODO: update "edit" page to offer ability to edit all attributes
@@ -1059,7 +1068,7 @@
         $data = serialize($struct);
   
         file_save_data($data, $cache_file, 1);
-	// file_save_data() closes fd and frees the lock
+        // file_save_data() closes fd and frees the lock
       }
     }
   }
@@ -1147,7 +1156,8 @@
   if (user_access('show banners')) {
     $files = array('banner_db.php', 'banner_file.php');
     $path = htmlspecialchars(file_create_path());
-    $file = $files[variable_get('banner_cache', '0')] ."?pos=$group&amp;path=$path&amp;max=". variable_get('banner_cache_max', '1');
+    $gid = banner_group_name($group);
+    $file = $files[variable_get('banner_cache', '0')] ."?pos=$gid&amp;path=$path&amp;max=". variable_get('banner_cache_max', '1');
     return '<script type="text/javascript" language="javascript" src="'."$base_url/$file".'"></script>';
   }
 }
