Index: creativecommons_lite.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/creativecommons_lite/creativecommons_lite.module,v
retrieving revision 1.2
diff -u -p -r1.2 creativecommons_lite.module
--- creativecommons_lite.module	12 May 2007 16:42:17 -0000	1.2
+++ creativecommons_lite.module	27 Jan 2008 23:15:07 -0000
@@ -1,5 +1,6 @@
 <?php
 // $Id: creativecommons_lite.module,v 1.2 2007/05/12 16:42:17 gloscon Exp $
+// edit by J-K@www.drupalcenter.de
 
 /**
  * This module will display 8 cc common license for selected content type 
@@ -8,6 +9,62 @@
 
 define('CC_LITE_PATH', drupal_get_path('module', 'creativecommons_lite'));
 
+/** from creativecommons.module
+ *
+ * Enclose each arg in paragraph tags.
+ */
+function para() {
+  $args = func_get_args();
+  $p = '';
+  foreach($args as $c)
+    $p .= "<p>$c</p>";
+  return $p;
+}
+
+/**
+ * Implementation of hook_perm().
+ */
+function creativecommons_lite_perm() {
+  return array('administer creative commons lite');
+}
+
+/**
+ * Implementation of hook_menu().
+ */
+
+function creativecommons_lite_menu($may_cache) {
+  $items = array();
+  if ($may_cache) {
+    $access = user_access('administer creative commons lite');
+    $items[] = array(
+      'path'      => 'admin/settings/creativecommons-lite',
+      'title'     => t('Creative Commons lite'),
+      'description' => t('Assign a Creative Commons license to content that appears on the site.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' =>  array('_creativecommons_lite_settings'),
+      'access'    => $access
+    );
+/*      $items[] = array(
+      'path'	=> 'admin/settings/creativecommons-lite/edit',
+      'title'     => t('Settings'),
+      'type'      => MENU_DEFAULT_LOCAL_TASK,
+      'weight'	=> -10
+    );
+
+Not yet implemented.
+
+  $items[] = array(
+      'path'      => 'admin/settings/creativecommons-lite/site',
+      'title'     => t('Site license'),
+      'callback'  => '_creativecommons_lite_settings',
+      'access'    => $access,
+      'type'      => MENU_LOCAL_TASK
+    ); */
+  }
+  return $items; 
+}
+
+
 /**
  * help hook for cclite module
  *
@@ -16,13 +73,89 @@ define('CC_LITE_PATH', drupal_get_path('
  */
 function creativecommons_lite_help($section) {
 
-  $cc_lite_desc_short = "Creative Commons eight license for drupal content.";
+
+ $cc_lite_desc = t('A Creative Commons license helps you publish your work online while letting others know exactly what they can and can\'t do with your work. Creative Commons offers a flexible range of protections and freedoms for authors and artists, built upon the "all rights reserved" concept of traditional copyright to create a voluntary "some rights reserved" copyright.');
+  $cc_lite_desc_short = t('Assign a Creative Commons license to content that appears on the site.');
+  $cc_lite_node = t('Attaching a Creative Commons license to a node within Drupal can designate the content of that node, as well as any attached files, as Creatively Commoned material.');
+  $cc_lite_url = t('For more information, visit <a href="http://creativecommons.org/learnmore" target="_blank">http://creativecommons.org/learnmore</a>.');
+
   switch ($section) {
     case 'admin/modules#description':
-      return t($cc_lite_desc_short);
+      return $cc_lite_desc_short;
+    case 'admin/settings/creativecommons-lite':
+      return para($cc_lite_desc, $cc_lite_node, $cc_lite_url);
+    case 'admin/help#creativecommons-lite':
+      return para($cc_lite_desc, $cc_lite_node, $cc_lite_url);
   }
 }
 
+
+/**
+ * Admin settings page
+ */
+
+function _creativecommons_lite_settings() {
+
+
+ /* $form['creativecommons_lite'] = array(
+    '#type' => 'fieldset', 
+    '#title' => t('Creative Commons lite settings'), 
+    '#collapsible' => TRUE, 
+    '#collapsed' => FALSE,
+  );
+
+ Not yet implemented.
+
+ $form['creativecommons_lite_rdf'] = array(
+		  '#type' => 'checkbox',
+		  '#title' => t('Insert RDF into HTML'),
+		  '#return_value' => 1,
+		  '#default_value' => variable_get('creativecommons_lite_rdf', TRUE),
+		  '#description' => t('Attach license information within the HTML to let your visitors know what license applies to your works.'),
+  );
+*/
+  $form['creativecommons_lite_ccversion'] = array(
+    '#type' => 'radios',
+    '#title' => t('Which version should be used'),
+    '#options' => array('2.0' => '2.0', '3.0' => '3.0'),
+    '#default_value' => variable_get('creativecommons_lite_ccversion', '2.0'),
+    '#description' => t('Which version of the Creative Commons licenses should used on this site.'),
+  );
+
+  $form['creativecommons_lite_jurisdiction'] = array(
+    '#type' => 'select',
+   /*  '#title' => t('Select a jurisdiction'),
+   '#options' => array("" => "", "ar" => "Argentina", "au" => "Australia", "at" => "Austria", "be" => "Belgium", "br" => "Brazil", "bg" => "Bulgaria", "ca" => "Canada", "cl" => "Chile", "cn" => "China Mainland", "co" => "Colombia", "hr" => "Croatia", "hu" => "Hungary", "dk" => "Denmark", "fi" => "Finland", "fr" => "France", "de" => "Germany", "il" => "Israel", "in" => "India", "it" => "Italy", "jp" => "Japan", "kr" => "Korea", "mk" => "Macedonia", "my" => "Malaysia", "mt" => "Malta", "mx" => "Mexico", "nl" => "Netherlands", "pe" => "Peru", "ph" => "Philippines", "pl" => "Poland", "pt" => "Portugal", "si" => "Slovenia", "za" => "South Africa", "es" => "Spain", "se" => "Sweden", "ch" => "Switzerland", "tw" => "Taiwan", "uk" => "UK: England & Wales", "scotland" => "UK: Scotland", "us" => "United States", "gr" => "Greece", "lu" => "Luxembourg", "nz" => "New Zealand", "rs" => "Serbia"),*/
+/*  This list I get from http://api.creativecommons.org/rest/dev/support/jurisdictions.js, and build this array via: 
+search & replace:
+	delete: <option value="http://creativecommons.org/international/ 
+	delete: </option>
+	replace: ^(.*)/">(.*)
+	  with:  "\1" => "\2",  
+*/
+
+/*  This list I get from http://creativecommons.org/licenses/by/2.0/, and build this array via: 
+search & replace:
+
+delete: <a href="./ 
+delete: hreflang=".*"
+delete: ^   rel=.*</a>$
+
+replace: ^deed\.(.*)" title="(.*)"
+	  with:  "\1" => "\2",  
+*/
+'#title' => t('Select a jurisdiction / language'),
+'#options' => array("" => "","af" => "Afrikaans", "bg" => "български",  "ca" => "Català",  "da" => "Dansk",  "de" => "Deutsch",  "en" => "English",  "en_CA" => "English (CA)",  "en_GB" => "English (GB)",  "en_US" => "English (US)",  "eo" => "Esperanto",  "es" => "Castellano",  "es_AR" => "Castellano (AR)",  "es_CL" => "Español (CL)",  "es_CO" => "Spanish (CO)",  "es_MX" => "Castellano (MX)",  "es_PE" => "Castellano (PE)",  "eu" => "Euskara", "fi" => "Suomeksi",  "fr" => "français",  "fr_CA" => "français (CA)",  "gl" => "Galego", "he" => "עברית",  "hr" => "hrvatski",  "hu" => "Magyar",  "it" => "Italiano",  "ja" => "日本語",  "ko" => "한국어",  "mk" => "Macedonian",  "ms" => "Melayu",  "nl" => "Nederlands",  "nso" => "Sesotho sa Leboa",  "pl" => "polski",  "pt" => "Português",  "sl" => "slovenski jezik",  "sr" => "српски ",  "sr_LATN" => "srpski (latinica)",  "st" => "Sotho",  "sv" => "svenska",  "zh" => "简体中文",  "zh_TW" => "華語 (台灣)",  "zu" => "isiZulu"),  
+
+    '#default_value' => variable_get('creativecommons_lite_jurisdiction', 'de'),
+    '#description' => t('Which jurisdiction of Creative Commons licenses should used on this site.'),
+  );
+
+  return system_settings_form($form);
+}
+
+
+
 /**
  * hook alter to add cc license
  *
@@ -71,17 +204,11 @@ function creativecommons_lite_form($node
 
   $cc_img = '<img src="'.$cc_img_path.'/cc-choose-license.gif" alt="'.t('Creative Commons licenses').'" /> ';
 
-  $cc_txt = '<p><a href="http://creativecommons.org/learn/licenses/" target="_blank">'.t('Creative Commons licenses').'</a> '.
-
-	  t('help you share your work while keeping your copyright. Other people can copy and distribute your work provided they give you credit&mdash;and only on the conditions you specify here.').
-
-	  '<a href="http://creativecommons.org/about/licenses/meet-the-licenses" target="_blank">'.t('Click here to view the explanation of licenses.').'</a> '.
-
-	  t('If you want to offer your work with no conditions, choose the ').'<a href="http://creativecommons.org/licenses/publicdomain/" target="_blank">'.t('public domain').'</a>.</p>';
+  $cc_txt = para(t('<a href="http://creativecommons.org/learn/licenses/" target="_blank">Creative Commons licenses</a> help you share your work while keeping your copyright. Other people can copy and distribute your work provided they give you credit&mdash;and only on the conditions you specify here. <a href="http://creativecommons.org/about/licenses/meet-the-licenses" target="_blank">Click here to view the explanation of licenses.</a>'),t('If you want to offer your work with no conditions, choose the ').'<a href="http://creativecommons.org/licenses/publicdomain/" target="_blank">'.t('public domain').'</a>.');
 
   // built html output
 
-  $output = t($cc_txt);
+  $output = $cc_txt;
 
   $prefix = 'cc_lite';
 
@@ -146,12 +273,13 @@ function get_license_html($license) {
 
   $license_info = get_license_info($license);
 
-     $txt = 'More info about '.l(t("Creative Commons Licensing"), 'http://creativecommons.org', array('rel' => 'license', 'title' => $license_info['license_name'], 'target' => '_blank' ))."\n"; 
+     $txt = t('More info about ').l(t("Creative Commons Licensing"), 'http://creativecommons.org', array('rel' => 'license', 'title' => $license_info['license_name'], 'target' => '_blank' ))."\n"; 
 
 	 $html = "\n<!--Creative Commons License-->\n";
 
-	 $html .= l(t("This work's Creative Commons license"), $license_info['license_uri'], array('rel' => 'license', 'title' => $license_info['license_name'], 'target' => '_blank' ))."<br>\n";
-
+// 	 $html .= l(t("This work's Creative Commons license"), $license_info['license_uri'], array('rel' => 'license', 'title' => $license_info['license_name'], 'target' => '_blank' ))."<br>\n";
+	 $html .= t("This work's Creative Commons license");
+	 $html .= l($license_info['license_name'], $license_info['license_uri'], array('rel' => 'license', 'target' => '_blank' ))."<br />\n";
    if ( $img = $license_info['images'] ) {  
 
       foreach ($img as $img_tag)
@@ -183,7 +311,7 @@ function creativecommons_lite_block($op=
   if ($op == "list") { 
   	
      $blocks[0] = array(
-       'info' => t('Creativecommon license'),
+       'info' => t('CreativeCommons license'),
        'weight' => 0, 
        'enabled' => 1,   // default make it enabled 
        'region' => 'right',  // garland has no right default
@@ -234,23 +362,27 @@ function creativecommons_lite_get_licens
 
   $types = array();
 
-  $types[''] = 'Choose one';
+  $types[''] = t('Choose one');
   
-  $types['publicdomain'] = 'Public Domain License';
+  $types['publicdomain'] = t('Public Domain License');
 
-  $types['ccdevnations'] = 'Developing Nations License';
+//   $types['ccdevnations'] = t('Developing Nations License'); 
+/*
+before I delete: this license is retired! Refer to http://creativecommons.org/retiredlicenses 
+J-K@www.drupalcenter.de
+*/
 
-  $types['by-nc-nd'] =  'Attribution Non-commercial No Derivatives';
+  $types['by-nc-nd'] =  t('Attribution Non-commercial No Derivatives');
 
-  $types['by-nc-sa'] = 'Attribution Non-commercial Share Alike';
+  $types['by-nc-sa'] = t('Attribution Non-commercial Share Alike');
 
-  $types['by-nc'] = 'Attribution Non-commercial';
+  $types['by-nc'] = t('Attribution Non-commercial');
 
-  $types['by-nd'] = 'Attribution No Derivatives';
+  $types['by-nd'] = t('Attribution No Derivatives');
 
-  $types['by-sa'] =  'Attribution Share Alike ';
+  $types['by-sa'] =  t('Attribution Share Alike');
 
-  $types['by'] = 'Attribution';
+  $types['by'] = t('Attribution');
 
   return $types;
 
@@ -372,60 +504,64 @@ function get_license_info( $license ) {
   $img_path = base_path().CC_LITE_PATH.'/images';
  
   $images = array();
-  
   switch( $license) {  
     case 'publicdomain':
-	  $license_info['license_name'] = 'Public Domain License';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/publicdomain/';
+	  $license_info['license_name'] = t('Public Domain License');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/publicdomain/deed.'.variable_get('creativecommons_lite_jurisdiction', 'de');
 	  $images[] = $img_path . '/40publicdomain.gif';
 	  
 	break;
+/*
+before I delete: this license is retired! Refer to http://creativecommons.org/retiredlicenses 
+J-K@www.drupalcenter.de
+
 	case 'ccdevnations': 
-	  $license_info['license_name'] = 'Developing Nations License';
+	  $license_info['license_name'] = t('Developing Nations License');
 	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/devnations/2.0/';
 	  $images[] = $img_path . '/40devnations.gif';
 	  
 	break;
+*/
 	case 'by-nc-nd':
-	  $license_info['license_name'] = 'Attribution Non-commercial No Derivatives';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc-nd/3.0/';
+	  $license_info['license_name'] = t('Attribution Non-commercial No Derivatives');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc-nd/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  $images[] = $img_path . '/icon-noncommercial.png';
 	  $images[] = $img_path . '/icon-derivative.png';
 	  
 	break;
 	case 'by-nc-sa':
-	  $license_info['license_name'] = 'Attribution Non-commercial Share Alike';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc-sa/3.0/';
+	  $license_info['license_name'] = t('Attribution Non-commercial Share Alike');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc-sa/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  $images[] = $img_path . '/icon-noncommercial.png';
 	  $images[] = $img_path . '/icon-sharealike.png';
 	  
 	break;	
 	case 'by-nc':
-	  $license_info['license_name'] =  'Attribution Non-commercial';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc/3.0/';
+	  $license_info['license_name'] =  t('Attribution Non-commercial');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nc/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  $images[] = $img_path . '/icon-noncommercial.png';
 	  
 	break;
 	case 'by-nd':
-	  $license_info['license_name'] = 'Attribution No Derivatives';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nd/3.0/';
+	  $license_info['license_name'] = t('Attribution No Derivatives');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-nd/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  $images[] = $img_path . '/icon-derivative.png';
 	  
 	break;
 	case 'by-sa':
-	  $license_info['license_name'] = 'Attribution Share Alike ';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-sa/3.0/';
+	  $license_info['license_name'] = t('Attribution Share Alike');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by-sa/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  $images[] = $img_path . '/icon-sharealike.png';
 	  
 	break;
 	case 'by':
-	  $license_info['license_name'] = 'Attribution';
-	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by/3.0/';
+	  $license_info['license_name'] = t('Attribution');
+	  $license_info['license_uri'] = 'http://creativecommons.org/licenses/by/'.variable_get('creativecommons_lite_ccversion', '2.0').'/'.variable_get('creativecommons_lite_jurisdiction', 'de').'/';
 	  $images[] = $img_path . '/icon.png';
 	  
 	break;
