Index: cck_field_privacy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck_field_privacy/cck_field_privacy.module,v
retrieving revision 1.3.2.2.2.6
diff -u -r1.3.2.2.2.6 cck_field_privacy.module
--- cck_field_privacy.module	6 Dec 2008 20:38:49 -0000	1.3.2.2.2.6
+++ cck_field_privacy.module	6 Dec 2008 21:49:32 -0000
@@ -187,19 +187,50 @@
                 // Let's add the field name to the array of fields
                 $cckfp_enabled_fields[$field] = $field_pref;
 
+                //Which padlock should we use?  First, determine if we're using a premade set.
+                $cckfp_icon_set = variable_get('cckfp_icon_set', 'color');
+                if ($cckfp_icon_set == "custom") {
+                  $cckfp_open_icon = check_plain(variable_get('cckfp_open_icon', 'padlock_green.png'));
+                  $cckfp_medium_icon = check_plain(variable_get('cckfp_medium_icon', 'padlock_yellow.png'));
+                  $cckfp_locked_icon = check_plain(variable_get('cckfp_locked_icon', 'padlock_red.png'));
+                }
+                elseif ($cckfp_icon_set == "white") {
+                  $cckfp_open_icon = "padlock_open.png";
+                  $cckfp_medium_icon = "padlock.png";
+                  $cckfp_locked_icon = "padlock_closed.png";
+                }
+                else {
+                  $cckfp_open_icon = "padlock_green.png";
+                  $cckfp_medium_icon = "padlock_yellow.png";
+                  $cckfp_locked_icon = "padlock_red.png";
+                }
+                switch ($field_pref) {
+                  case "b":
+                    $padlock = $cckfp_medium_icon;
+                  break;
+                  case "n":
+                    $padlock = $cckfp_locked_icon;
+                  break;
+                  case "e":
+                  default:
+                    $padlock = $cckfp_open_icon;
+                  break;
+                }
+                
+
                 // Add the padlock icon & link to the JQuery function
                 // @TODO: Add this via jQuery to degrade gracefully in browsers without JavaScript enabled.
                 // @TODO: Get the padlock to also appear on field group titles (fieldset legends), if selected.
                 if (isset($form[$field]['#title'])) {
-                  $form[$field]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/padlock.png' /></a>";
+                  $form[$field]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/". $padlock ."' /></a>";
                 }
                 if (isset($form_field['#title'])) {
-                  $form_field['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/padlock.png' /></a>";
+                  $form_field['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/". $padlock ."' /></a>";
                 }
                 if (isset($form_field[0]['#title'])) {
-                  $form_field[0]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/padlock.png' /></a>";
+                  $form_field[0]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/". $padlock ."' /></a>";
                 }
-                $form['#field_info'][$field]['widget']['label'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/padlock.png' /></a>";
+                $form['#field_info'][$field]['widget']['label'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/". $padlock ."' /></a>";
               }
             }
           }
@@ -299,7 +330,7 @@
       if ($enabled_type) {
         $form['field_fields'][$enabled_type] = array(
           '#type' => 'fieldset',
-          '#title' => $types[$enabled_type]['name'] .' content fields',
+          '#title' => t($types[$enabled_type]['name'] .' content fields'),
           '#description' => t('Checking this box will hide this complete field group'),
         );
 
@@ -312,7 +343,7 @@
 
             $form['field_fields'][$enabled_type][$enabled_type .'_'. $field['field_name']]= array(
               '#type' => 'checkbox',
-              '#title' => $field['widget']['label'],
+              '#title' => t($field['widget']['label']),
               '#description' => t(''),
               '#default_value' => $the_settings[$enabled_type][$field['field_name']],
               '#description' => t('Enable permissions on this field.'),
@@ -331,11 +362,60 @@
       }
     }
   }
+  
+  $form['cckfp_icons'] = array(
+    '#type' => 'radios',
+    '#options' => array('color' => t('Colored Icons'), 'white' => t('White Icons'), 'custom' => t('Custom Icons')),
+    '#weight' => 1,
+    '#description' => t('Select a type of privacy icons to display.  Two sets are included, while any number of other icons can be used by placing the icons in the icons/ subfolder of the CCK Field Privacy module and specifying the icon filenames below.'),
+    '#title' => t('Privacy Icon Set to Use'),
+    '#default_value' => variable_get('cckfp_icon_set', 'color'),
+  );
+  
+  $form['cckfp_custom_icons'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#title' => t('Privacy Icon Settings'),
+    '#weight' => 2,
+  );
+ 
+  $form['cckfp_custom_icons']['locked_icon'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Icon to use for locked privacy'),
+    '#description' => t('Enter a filename for the icon to use when the privacy icon should display a locked status (such as a "Nobody" setting).  The file must be placed in the icons/ subdirectory in the CCK Field Privacy module folder.'),
+    '#default_value' => variable_get('cckfp_locked_icon', NULL),
+    '#size' => 50,
+    '#maxlength' => 96,
+    '#weight' => 0,
+  );
 
+  $form['cckfp_custom_icons']['medium_icon'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Icon to use for medium privacy'),
+    '#description' => t('Enter a filename for the icon to use when the privacy icon should display a medium status (such as a "Buddies" setting).  The file must be placed in the icons/ subdirectory in the CCK Field Privacy module folder.'),
+    '#default_value' => variable_get('cckfp_medium_icon', NULL),
+    '#size' => 50,
+    '#maxlength' => 96,
+    '#weight' => 1,
+  );
+  
+  $form['cckfp_custom_icons']['open_icon'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Icon to use for open privacy'),
+    '#description' => t('Enter a filename for the icon to use when the privacy icon should display an open status (such as a "Everyone" setting).  The file should be placed in the icons/ subdirectory in the CCK Field Privacy module folder.'),
+    '#default_value' => variable_get('cckfp_open_icon', NULL),
+    '#size' => 50,
+    '#maxlength' => 96,
+    '#weight' => 2,
+  );
+  
   $form['submit'] = array(
     '#type' => 'submit',
-    '#value' => t('Save')
+    '#value' => t('Save'),
+    '#weight' => 3,
   );
+  
   return $form;
 }
 
@@ -410,6 +490,11 @@
       variable_set($key, $value);
     }
   }
+
   variable_set('cckfp_values', serialize($stored_values));
+  variable_set('cckfp_icon_set', $form_state['values']['cckfp_icons']);
+  variable_set('cckfp_locked_icon', $form_state['values']['locked_icon']);
+  variable_set('cckfp_medium_icon', $form_state['values']['medium_icon']);
+  variable_set('cckfp_open_icon', $form_state['values']['open_icon']);
   drupal_set_message('Settings Changed.');
 }
\ No newline at end of file

