CcLicence

DefaultOnline | RecentChanges | Preferences

"CC licence" patch

This patch allows user to choose a given creative commons licence for each wiki page. Once selected, at the end of the page the licence (with image) is shown, and a machine-readable RDF code is embedded (which will be used by some searchengines to index creative commons licenced content)

The licence, it's name and url and RDF params can be defined at the configuration part of the usemod-script (lines 178 to 198)

The user can select the licence at the end of the editpage. The selection can not be revoked. That might be harsh, but it ensures in anopen environment like the usemod wiki is, that the licence of a page can not be switched form "normal/no licence" to "creative commons licence" and back.

You can see a working version of the patch at http://osm.dekoder.de/cgi-bin/wiki-osm.pl?LearningStadtraum/Utopia, where the following screenshot comes from:

drop me line, if you have a comment on this patch: ulf (dot) treger (at) dekoder (dot) de

(check for the lines marked with "!" and "+")




*** usemod10/wiki.pl	Thu Sep 11 14:21:02 2003
--- wiki_1_0_cc_patch.pl	Sat Mar 17 16:13:20 2007
***************
*** 53,59 ****
    @IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader
    $UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload
    $UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton 
!   $EditNameLink $UseMetaWiki @ImageSites $BracketImg );
  # Note: $NotifyDefault is kept because it was a config variable in 0.90
  # Other global variables:
  use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
--- 53,61 ----
    @IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader
    $UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload
    $UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton 
!   $EditNameLink $UseMetaWiki @ImageSites $BracketImg 
!   $SelectLicence $LicenceURL $LicenceText $LicenceAbbr @LicenceRdfParams 
!   );
  # Note: $NotifyDefault is kept because it was a config variable in 0.90
  # Other global variables:
  use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
***************
*** 176,181 ****
--- 178,198 ----
  $UseMetaWiki  = 0;      # 1 = add MetaWiki search links, 0 = no MW links
  $BracketImg   = 1;      # 1 = [url url.gif] becomes image link, 0 = no img
  
+ # licence patch
+ $SelectLicence = 1;         # 1 = select a cc licence,  0 = no licence selection
+ $LicenceURL = "http://creativecommons.org/licenses/by-sa/2.5/";  
+ $LicenceText = "Creative Commons Attribution-ShareAlike 2.5";
+ $LicenceAbbr = "by-sa";
+ # these values come form http://creativecommons.org/license/results-one?license_code=by-sa
+ # you can validate the rdf code with http://validator.creativecommons.org/
+ @LicenceRdfParams = (   '<permits rdf:resource="http://web.resource.org/cc/Reproduction"/>',
+                         '<permits rdf:resource="http://web.resource.org/cc/Distribution"/>',
+                         '<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>',                        
+                         '<requires rdf:resource="http://web.resource.org/cc/Notice"/>',
+                         '<requires rdf:resource="http://web.resource.org/cc/Attribution"/>',
+                         '<requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>',
+                      );
+                      
  # Names of sites.  (The first entry is used for the number link.)
  @IsbnNames = ('bn.com', 'amazon.com', 'search');
  # Full URL of each site before the ISBN
***************
*** 1387,1392 ****
--- 1404,1413 ----
      return $q->end_html;
    }
    $result = '<div class=wikifooter>';
+   if ( $Section{'licence'} eq $LicenceAbbr ) {
+     $result .= &GetLicenceText($id);
+     $result .= "<hr class=\"wikilinelicence\" />\n";
+   }  
    $result .= &GetFormStart();
    $result .= &GetGotoBar($id);
    if (&UserCanEdit($id, 0)) {
***************
*** 2346,2351 ****
--- 2367,2375 ----
    $Section{'id'} = $UserID;
    $Section{'username'} = &GetParam("username", "");
    $Section{'data'} = $data;
+   if ( $SelectLicence ) {
+      $Section{'licence'} = &GetParam("licence", "copyright");      # Licence
+   }  
    $Page{$name} = join($FS2, %Section);  # Replace with save?
  }
  
***************
*** 2450,2455 ****
--- 2474,2480 ----
    $Section{'id'} = $UserID;
    $Section{'username'} = &GetParam("username", "");
    $Section{'data'} = $data;
+   $Section{'licence'} = &GetParam("licence", "copyright" ) unless ( $Section{'licence'} eq $LicenceAbbr );  
    $Page{$name} = join($FS2, %Section);
  }
  
***************
*** 3249,3254 ****
--- 3274,3298 ----
      print &GetHiddenValue("revision", $revision), "\n";
    }
    print &GetTextArea('text', $oldText, $editRows, $editCols);
+ 
+   # licence patch
+   if ($SelectLicence) {
+      if ( $Section{'licence'} eq $LicenceAbbr ) {
+        # if a cc licence was choosen, just show this info:
+        print "<p>\n".&GetLicenceText."</p>\n";
+      } else {
+         # let author choose a licence
+         print "<p>", T('Publish the content of this page under a Creative Commons licence?<br />'),
+           $q->radio_group( -name=>'licence',
+                                     -values=>['copyright',$LicenceAbbr],
+                                     -labels=>{'copyright'=>'No/not yet',
+                                              $LicenceAbbr=>$LicenceText,
+                                              },);
+         print ' (<a href="'.$LicenceText.'">Info</a>)';                                         
+         print '<br /><small>Please note: Choosing a CC licence can not be revoked!</small></p>';
+      }
+   }
+   
    $summary = &GetParam("summary", "*");
    print "<p>", T('Summary:'),
          $q->textfield(-name=>'summary',
***************
*** 3427,3433 ****
    return $q->checkbox(-name=>"p_$name", -override=>1, -checked=>$checked,
                        -label=>$label);
  }
! 
  sub DoUpdatePrefs {
    my ($username, $password, $stylesheet);
  
--- 3471,3496 ----
    return $q->checkbox(-name=>"p_$name", -override=>1, -checked=>$checked,
                        -label=>$label);
  }
! # licence patch
! sub GetLicenceText { 
!     my $id = shift;
!     my $url = $FullUrl.&ScriptLinkChar.$id;
!     my $result = <<LICENCE;
! 
! <!--Creative Commons License--><a rel="license" href="$LicenceURL"><img alt="Creative Commons License" style="border-width: 0" src="http://i.creativecommons.org/l/$LicenceAbbr/2.5/88x31.png"/></a><br/>This work is licensed under a <a rel="license" href="$LicenceURL">$LicenceText License</a>.<!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
! 	<Work rdf:about="$url">
! 		<license rdf:resource="$LicenceURL" />
! 	<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
! 	</Work>
! 	<License rdf:about="$LicenceURL">
! LICENCE
!    
!     foreach my $param (@LicenceRdfParams) {
!       $result .= $param;
!     } 
!     $result .= "</License>\n</rdf:RDF> -->\n\n";
!     return $result;
! }
  sub DoUpdatePrefs {
    my ($username, $password, $stylesheet);
  


DefaultOnline | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited March 17, 2007 5:08 pm by Ulf T (diff)
Search: