Index: creativecommons/creativecommons.module
===================================================================
--- creativecommons/creativecommons.module
+++ creativecommons/creativecommons.module
@@ -177,9 +177,9 @@
     '#return_value' => 1,
     '#default_value' => variable_get('creativecommons_rdf', TRUE),
     '#description' => t('Attach machine-readable license information within the HTML to let visitors know what license applies to your works.'),
-  );
+  );        
+
   return system_settings_form($form);
-
 }
 
 /**
@@ -225,7 +225,7 @@
   if (!in_array('', $available_license_types)) {
     $available_license_types = array_merge( array('' => ''), $available_license_types );
   }
-
+  
   $form['creativecommons_default_license']['creativecommons_default_license_type'] = array(
     '#type' => 'select',
     '#title' => t('License type'),
@@ -349,64 +349,66 @@
     $desired_license = creativecommons_get_default_license();
   }
 
+  if ($desired_license->uri == 'user') $selected_license_uri = 'user';
+  
+  else {
 
+    /**
+     * Check the desired URI against the list.
+     *
+     * There are three (known) cases (in order) where the desired uri won't be in 
+     * the list:
+     *  1. the license type is no longer available;
+     *  2. the default jurisdiction has changed;
+     *  3. a new version of the license has been released.
+     */
+    $selected_license_uri = creativecommons_get_license_uri_from_available($desired_license->type, $default_jurisdiction);
 
-  /**
-   * Check the desired URI against the list.
-   *
-   * There are three (known) cases (in order) where the desired uri won't be in 
-   * the list:
-   *  1. the license type is no longer available;
-   *  2. the default jurisdiction has changed;
-   *  3. a new version of the license has been released.
-   */
-  $selected_license_uri = creativecommons_get_license_uri_from_available($desired_license->type, $default_jurisdiction);
+    // Warn user if changed (if selected doesn't match desired, or (special case) if node->cc is None but that's not available)
+    if (($desired_license->uri != $selected_license_uri) || ($node->cc && !$desired_license->uri && !$desired_license->is_available())) {
+      $selected_license = new creativecommons_license($selected_license_uri);
 
-  // Warn user if changed (if selected doesn't match desired, or (special case) if node->cc is None but that's not available)
-  if (($desired_license->uri != $selected_license_uri) || ($node->cc && !$desired_license->uri && !$desired_license->is_available())) {
-    $selected_license = new creativecommons_license($selected_license_uri);
-
-    // Case 1: License is no longer available
-    if (!$desired_license->is_available()) {
-      $message = '"'. $desired_license->get_full_name() .'" is no longer an option. Please review license selection.';
+      // Case 1: License is no longer available
+      if (!$desired_license->is_available()) {
+        $message = '"'. $desired_license->get_full_name() .'" is no longer an option. Please review license selection.';
+      }
+      // Case 2: Jurisdiction change (same license type)
+      elseif ($desired_license->jurisdiction != $selected_license->jurisdiction) {
+        $message = 'The jurisdiction of your license will be changed from '. $jurisdictions[$desired_license->jurisdiction] .' to '. $jurisdictions[$selected_license->jurisdiction] .'. Please review.';
+      }
+      // Case 3: Version change (upgrade)
+      elseif ($desired_license->version != $selected_license->version) {
+        $message = 'The version of your license will be changed from '. $desired_license->version .' to '. $selected_license->version .'. Please review.';
+      }
+      // Any other cases?
+      else {
+        $message = 'Your license selection is set to be altered. Please review.';
+      }
+      drupal_set_message($message, 'warning');
     }
-    // Case 2: Jurisdiction change (same license type)
-    elseif ($desired_license->jurisdiction != $selected_license->jurisdiction) {
-      $message = 'The jurisdiction of your license will be changed from '. $jurisdictions[$desired_license->jurisdiction] .' to '. $jurisdictions[$selected_license->jurisdiction] .'. Please review.';
-    }
-    // Case 3: Version change (upgrade)
-    elseif ($desired_license->version != $selected_license->version) {
-      $message = 'The version of your license will be changed from '. $desired_license->version .' to '. $selected_license->version .'. Please review.';
-    }
-    // Any other cases?
-    else {
-      $message = 'Your license selection is set to be altered. Please review.';
-    }
-    drupal_set_message($message, 'warning');
-  }
 
 
 
-  /**
-    * If selected_license_uri is blank but None is not an available type,
-    * then a blank entry is placed at the beginning of the list (and the field 
-    * is set to required). This forces the user to actively select a license,
-    * rather than just defaulting to the first on the list.
-    *
-    * This will only arise in the following cases:
-    *  - if content had no license (None), but that is no longer an available type
-    *  - if there is no site default set, but None is not an available type
-    */
-  if (!$selected_license_uri && !in_array('', $available_license_types)) {
-    $available_licenses = array_merge( array('' => ''), $available_licenses);
+    /**
+      * If selected_license_uri is blank but None is not an available type,
+      * then a blank entry is placed at the beginning of the list (and the field 
+      * is set to required). This forces the user to actively select a license,
+      * rather than just defaulting to the first on the list.
+      *
+      * This will only arise in the following cases:
+      *  - if content had no license (None), but that is no longer an available type
+      *  - if there is no site default set, but None is not an available type
+      */
+    if (!$selected_license_uri && !in_array('', $available_license_types)) {
+      $available_licenses = array_merge( array('' => ''), $available_licenses);
+    }
+  
   }
-
-
-
+  
   /**
    * (After all this hard work,) the form element.
    */
-  $form['select_license_form'][$key] = array(
+ $form['select_license_form'][$key] = array(
     '#type' => 'select',
     '#title' => t('Creative Commons License'),
     '#default_value' => $selected_license_uri,
@@ -414,9 +416,19 @@
     '#attributes' => $extra,
     '#description' => NULL,
     '#required' => !in_array('', $available_license_types) ? TRUE : FALSE,
-  );
+  ); 
+  
+  // Add text field to enter User Defined custom license text; but hide it unless User Defined is selected.
+  $form['select_license_form']['other_description'] = array(
+    '#type' => 'textarea',
+    '#rows' => 10,
+    '#title' => t('User Defined - Custom License Text'),
+    '#prefix' =>  '<div id="cc_other_description" style="display:none">',
+    '#suffix' => '</div>',
+    '#default_value' => db_result(db_query('SELECT text from {creativecommons_user} WHERE nid = %d', $node->nid)),
+    '#description' => 'Enter custom licesne text specific to this '. $node->type,
+  );    
 
-
   return $form;
 }
 
@@ -424,6 +436,9 @@
  * Provides license uri validation for form validate methods to use.
  */
 function creativecommons_validate_license_uri($license_uri_key, $license_uri) {
+  // if a custom user-defined license let's not validate uri
+  if ($license_uri == 'user') return;
+  
   // Check to see if selected license is available
   $cc = new creativecommons_license($license_uri);
   if ($cc->has_license() && !$cc->is_available()) {
@@ -558,7 +573,8 @@
   // License classes
   $licenses['Creative Commons'] = array();
   $licenses['Public Domain'] = array();
-
+  $licenses['Other'] = array();
+  
   // Manual adjustments for 'standard' class
   $parser = xml_parser_create();
   xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
@@ -594,7 +610,10 @@
     $licenses['Public Domain'][$zero->type] = creativecommons_generic_license_name($zero->get_full_name());
   else
     $licenses['Public Domain'][$zero->uri] = $zero->get_full_name();
-
+    
+  // Add 'Other' option to allow for custom license text.
+  $licenses = array_merge($licenses, array('Other' => array('user' => 'User Defined')));  
+  
   return $licenses;
 }
 
@@ -903,8 +922,9 @@
   switch ($op) {
     // settings   'form post replaced by form_api
     case 'load':
-      if (creativecommons_node_type_is_enabled($node->type))
+      if (creativecommons_node_type_is_enabled($node->type)) {
         $node->cc = creativecommons_load($node);
+      }
       break;
 
     case 'view':
@@ -951,7 +971,8 @@
     // Add CC license selection to node form
     $node = $form['#node'];
     if (creativecommons_node_type_is_enabled($node->type)) {
-        $form = array_merge($form, creativecommons_node_form($form['#node'], $form_state));
+      drupal_add_js(drupal_get_path('module', 'creativecommons') . "/js/user_defined.js");
+      $form = array_merge_recursive($form, creativecommons_node_form($form['#node'], $form_state));
     }
   }
 
@@ -1138,6 +1159,9 @@
   );
   $form['creativecommons'][] = array('#value' => $output);
   $form['creativecommons']['select_license_form'] = $output1['select_license_form'];
+  
+  
+  
 
   global $user;
   $link_txt = 'Click to include more information about your work.';
@@ -1270,9 +1294,6 @@
   $cc = new creativecommons_license($_POST['creativecommons']['select_license_form']['cc_license_uri']);
   $cc->save($node->nid);
 
-  //TODO: is this line necessary?
-  $node->cc = $cc;
-
   return;
 }
 
@@ -1281,7 +1302,8 @@
   */
 function creativecommons_delete($node) {
   if ($node->nid) {
-    db_query("DELETE FROM {creativecommons} WHERE nid = %d", $node->nid);
+    db_query("DELETE FROM {creativecommons} WHERE nid = %d", $node->nid);    
+    db_query("DELETE FROM {creativecommons_user} WHERE nid = %d", $node->nid);
   }
   return;
 }
Index: creativecommons/creativecommons.class.php
===================================================================
--- creativecommons/creativecommons.class.php	
+++ creativecommons/creativecommons.class.php	
@@ -49,6 +49,11 @@
 
     $this->uri = $license_uri;
     
+    if ($this->uri == 'user') {
+      $this->type = 'user';
+      return;
+    }
+    
     // Load license information
     $this->load();
 
@@ -58,7 +63,7 @@
   /**
    * Load basic information from uri and XML data from API into object.
    */
-  function load(){
+  function load(){ 
     // Load basic data from uri
     $uri_parts = explode('/', $this->uri);
     $this->type = $uri_parts[4];
@@ -402,9 +407,14 @@
     //TODO: improve error handling
     if (!$nid) {
       drupal_set_message('A node must be specified to save a license', 'error');
+    }       
+    
+    if ($this->uri == 'user') {
+      $result1 = db_query("INSERT INTO {creativecommons} (nid, license_uri) VALUES (%d, '%s')",  $nid, $this->uri); 
+      $result2 = db_query("INSERT INTO {creativecommons_user} (nid, text) VALUES (%d, '%s')",  $nid, $_POST['creativecommons']['select_license_form']['other_description']);
+      return $result1 & $result2;
     }
-
-    if ($nid && $this->has_license() && $this->is_available()) {
+    else if ($this->has_license() && $this->is_available()) {
       $result = db_query("INSERT INTO {creativecommons} (nid, license_uri) VALUES (%d, '%s')",  $nid, $this->uri);
       return $result;
     }
Index: creativecommons/js/user_defined.js
===================================================================
--- creativecommons/js/user_defined.js
+++ creativecommons/js/user_defined.js
@@ -0,0 +1,20 @@
+$(document).ready(function() {
+  // call Description field for User Defined license if User Defined is selected license type
+  cc_showUserDefinedDescription();
+  
+  // add the onChange handler to hide/show the cost fields
+  $('#edit-creativecommons-select-license-form-cc-license-uri').change(cc_showUserDefinedDescription);
+});
+
+function showCostFields() {  
+  
+  // hide form fields
+  // look for the 'None (All Rights Reserved)' option which contains a blank value
+  if ($('#edit-creativecommons-select-license-form-cc-license-uri').val() == "user") {
+    $('#cc_other_description').show();
+  }
+  else {
+    $('#cc_other_description').hide();
+  }
+}
+