Index: avatar_selection.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/avatar_selection/avatar_selection.module,v
retrieving revision 1.1.2.20.2.8
diff -u -r1.1.2.20.2.8 avatar_selection.module
--- avatar_selection.module 3 Feb 2008 23:04:27 -0000 1.1.2.20.2.8
+++ avatar_selection.module 1 Mar 2008 00:18:11 -0000
@@ -160,10 +160,13 @@
       unset($form['picture']['picture_delete']);
     }

-    $num_images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
+    $images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
     $js_settings = array(
-      'num_images_per_page' => ($num_images_per_page ? $num_images_per_page : 1),
+      'num_images_per_page' => ($images_per_page ? $images_per_page : 1),
       'num_images' => $selects['total'],
+      'base_path' => base_path(),
+      'image_path' => file_create_path('avatar_selection'),
+      'images' => $selects['avatars_indexed'],
     );
     drupal_add_js(array('avatar_selection' => $js_settings), 'setting');
     drupal_add_js(drupal_get_path('module', 'avatar_selection') .'/js/avatar_selection.js', 'module', 'header');
@@ -192,10 +195,13 @@
         '#attributes' => array('class' => 'user_avatar_select'),
       );
     }
-    $num_images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
+    $images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
     $js_settings = array(
-      'num_images_per_page' => ($num_images_per_page ? $num_images_per_page : 1),
+      'num_images_per_page' => ($images_per_page ? $images_per_page : 1),
       'num_images' => $selects['total'],
+      'base_path' => base_path(),
+      'image_path' => file_create_path('avatar_selection'),
+      'images' => $selects['avatars_indexed'],
     );
     drupal_add_js(array('avatar_selection' => $js_settings), 'setting');
     drupal_add_js(drupal_get_path('module', 'avatar_selection') .'/js/avatar_selection.js', 'module', 'header');
@@ -312,10 +318,15 @@

   $total_avatars = count($listings);

+  $c = 0;
   foreach ($listings as $listing) {
-    $avatars[$dir .'/'. $listing->basename] = theme('image', file_create_url($dir .'/'. $listing->basename), $listing->basename, $listing->basename, NULL, FALSE);
+    //$avatars[$dir .'/'. $listing->basename] = theme('image', file_create_url($dir .'/'. $listing->basename), $listing->basename, $listing->basename, NULL, FALSE);
+    $avatars_indexed[$c] = $listing->basename;
+    $avatars[$listing->basename] = "";
+    $c++;
   }

+  $selects['avatars_indexed'] = $avatars_indexed;
   $selects['avatars'] = $avatars;
   $selects['total'] = $total_avatars;

@@ -506,6 +517,7 @@
     if ($step == "list") {
       $form['#redirect'] = FALSE;

+      $images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
       $form['select_avatar'] = array(
         '#type' => 'radios',
         '#title' => t('Select an avatar to edit'),
@@ -519,10 +531,12 @@
         '#value' => t('Edit'),
       );

-      $num_images_per_page = variable_get('avatar_selection_avatar_per_page', 30);
       $js_settings = array(
-        'num_images_per_page' => ($num_images_per_page ? $num_images_per_page : 1),
+        'num_images_per_page' => ($images_per_page ? $images_per_page : 1),
         'num_images' => $selects['total'],
+        'base_path' => base_path(),
+        'image_path' => file_create_path('avatar_selection'),
+        'images' => $selects['avatars_indexed'],
       );
       drupal_add_js(array('avatar_selection' => $js_settings), 'setting');
       drupal_add_js(drupal_get_path('module', 'avatar_selection') .'/js/avatar_selection.js', 'module', 'header');
@@ -538,7 +552,9 @@
         $og_access = preg_split('/\s*,\s*/', $avatar->og_access);
       }

-      $image = theme('image', $form_values['select_avatar']);
+      $image_path = file_create_path('avatar_selection');
+      $selected_avatar = $form_values['select_avatar'];
+      $image = theme('image', $image_path .'/'. $selected_avatar);
       $form['avatar_image'] = array('#value' => $image);
       $form['select_avatar'] = array(
         '#type' => 'value',
Index: js/avatar_selection.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/avatar_selection/js/Attic/avatar_selection.js,v
retrieving revision 1.1.2.1.2.2
diff -u -r1.1.2.1.2.2 avatar_selection.js
--- js/avatar_selection.js 28 Jan 2008 11:00:29 -0000 1.1.2.1.2.2
+++ js/avatar_selection.js 1 Mar 2008 00:18:11 -0000
@@ -1,19 +1,11 @@
-/* $Id: avatar_selection.js,v 1.1.2.1.2.2 2008/01/28 11:00:29 snpower Exp $ */
+/* $id: avatar_selection.js,v 1.1.2.1.2.2 2008/01/28 11:00:29 snpower exp $ */
 if (Drupal.jsEnabled) {
   $(document).ready(function () {
     // set up the ajax pager
     $('div.user_avatar_select').avatar_selection_pager('div.form-item');

     // handle radio buttons
-    $('div.user_avatar_select input.form-radio').hide();
-    $('div.user_avatar_select img').hover(
-      function(){
-        $(this).addClass("avatar_hover");
-      },
-      function(){
-        $(this).removeClass("avatar_hover");
-      }
-    );
+    radio_button_handler();

     $('div.user_avatar_select img').bind("click",function(){
       $("div.user_avatar_select img.avatar_select").each(function(){
@@ -25,6 +17,18 @@
     });
   });

+  function radio_button_handler() {
+    // handle radio buttons
+    $('div.user_avatar_select input.form-radio').hide();
+    $('div.user_avatar_select img').hover(
+      function(){
+        $(this).addClass("avatar_hover");
+      },
+      function(){
+        $(this).removeClass("avatar_hover");
+      }
+    );
+  }

   // pager function
   $.fn.avatar_selection_pager = function(element) {
@@ -38,7 +42,10 @@
       next_link: '&raquo;',
       height: null,
       num_images_per_page: drupal_settings.num_images_per_page,
-      num_images: drupal_settings.num_images
+      num_images: drupal_settings.num_images,
+      image_path: drupal_settings.image_path,
+      base_path: drupal_settings.base_path,
+      images: drupal_settings.images
     }

     return this.each( function () {
@@ -49,14 +56,16 @@
       var page_nav = '#'+settings.pager_id;

       function init_pager () {
-        size = $(element, me).not(page_nav).size();
+        //size = $(element, me).not(page_nav).size();
+        size = settings.num_images;
         size = Math.ceil(size/settings.num_images_per_page);
         if (settings.height == null) {
           settings.height = get_element_height();
         }
         if (size > 1) {
           make_pager_list();
-          show();
+          //show();
+          img_show();
           set_active();
         }
         set_height();
@@ -87,6 +96,25 @@
         }
       }

+      function img_show() {
+        $(me).find(element).not(page_nav).hide();
+        i = i * settings.num_images_per_page;
+        var count = i;
+        $(me).find(element).not(page_nav).each(function () {
+          var max_image = 1*i + 1*settings.num_images_per_page;
+          if (count < settings.num_images && count < max_image) {
+            var image_name = settings.images[count];
+            var input = '<input name="select_avatar" class="form-radio user_avatar_select" type="radio" value="'+ image_name +'">';
+            var image = '<img class="" alt="'+ image_name +'" title="'+ image_name +'" src="'+settings.base_path + settings.image_path +"/"+ image_name +'" />';
+
+            $(this).find("label").html(input + image);
+            $(this).show();
+            count++;
+          }
+        });
+        radio_button_handler();
+      }
+
       function set_active () {
         $(me).find(page_nav).find('a').removeClass(settings.active_class);
         var page_num = Math.floor(i/settings.num_images_per_page) + 1;
@@ -145,7 +173,8 @@
           var j = $(this).attr('rel');
           i = j-1;
         }
-        show();
+        img_show();
+        //show();
         set_active();
         return false;
       });
