Index: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java
===================================================================
--- content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java (revision 0)
+++ content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java (revision 0)
@@ -0,0 +1,72 @@
+package org.sakaiproject.content.copyright;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.sakaiproject.component.api.ServerConfigurationService;
+
+public class CopyrightManager implements org.sakaiproject.content.copyright.api.CopyrightManager {
+
+ static final Log logger = LogFactory.getLog(CopyrightManager.class);
+
+ protected boolean active = true;
+
+ /** Dependency: ServerConfigurationService. */
+ protected ServerConfigurationService m_serverConfigurationService = null;
+ /**
+ * Dependency: ServerConfigurationService.
+ *
+ * @param service
+ * The ServerConfigurationService.
+ */
+ public void setServerConfigurationService(ServerConfigurationService service) {
+ m_serverConfigurationService = service;
+ }
+
+ public org.sakaiproject.content.copyright.api.CopyrightInfo getCopyrightInfo(Locale locale, String [] rights, URL serverURL){
+ String baseURL = getBaseURL(serverURL.getFile());
+ CopyrightInfo copyrightInfo = new CopyrightInfo();
+ String[] copyright_types = m_serverConfigurationService.getStrings("copyright.types");
+ if (copyright_types==null) {
+ active = false;
+ copyright_types = rights;
+ }
+ ResourceBundle rb = ResourceBundle.getBundle("org.sakaiproject.content.copyright.copyright",locale);
+ String language = locale.getLanguage();
+ for (String copyrightType:copyright_types){
+ CopyrightItem item = new CopyrightItem();
+ if (active) {
+ item.setType(copyrightType);
+ item.setText(rb.getString(copyrightType));
+ if (existsFile("/library/content/copyright/" + copyrightType + "_" + language + ".html",baseURL)) {
+ item.setLicenseUrl("/library/content/copyright/" + copyrightType + "_" + language + ".html");
+ } else if (existsFile("/library/content/copyright/" + copyrightType + ".html",baseURL)) {
+ item.setLicenseUrl("/library/content/copyright/" + copyrightType + ".html");
+ }
+ } else {
+ item.setType(copyrightType);
+ item.setText(copyrightType);
+ }
+ copyrightInfo.add(item);
+ }
+ return copyrightInfo;
+ }
+
+ public String getUseThisCopyright(String [] rights) {
+ return active?org.sakaiproject.content.copyright.api.CopyrightManager.USE_THIS_COPYRIGHT:rights[rights.length-1];
+ }
+
+ private String getBaseURL(String serverURL) {
+ return serverURL.substring(0,serverURL.indexOf("WEB-INF"))+"..";
+ }
+
+ private boolean existsFile(String file,String baseURL) {
+ File f = new File(baseURL+file);
+ return f.exists();
+ }
+
+}
\ No newline at end of file
Property changes on: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightManager.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightInfo.java
===================================================================
--- content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightInfo.java (revision 0)
+++ content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightInfo.java (revision 0)
@@ -0,0 +1,19 @@
+package org.sakaiproject.content.copyright;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class CopyrightInfo implements org.sakaiproject.content.copyright.api.CopyrightInfo {
+ List items = new ArrayList();
+
+ public CopyrightInfo(){
+ items = new ArrayList();
+ }
+ public void add(org.sakaiproject.content.copyright.api.CopyrightItem item){
+ items.add(item);
+ }
+ public List getItems(){
+ return items;
+ }
+
+}
\ No newline at end of file
Property changes on: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightInfo.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightItem.java
===================================================================
--- content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightItem.java (revision 0)
+++ content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightItem.java (revision 0)
@@ -0,0 +1,36 @@
+package org.sakaiproject.content.copyright;
+
+public class CopyrightItem implements org.sakaiproject.content.copyright.api.CopyrightItem {
+ private String type;
+ private String text;
+ private String licenseUrl;
+
+ public CopyrightItem(){}
+ public CopyrightItem(String type, String text, String url){
+ this.type = type;
+ this.text = text;
+ this.licenseUrl = url;
+ }
+
+ public void setType(String s){
+ this.type = s;
+ }
+ public String getType(){
+ return this.type;
+ }
+
+ public void setText(String s){
+ this.text = s;
+ }
+ public String getText(){
+ return this.text;
+ }
+
+ public void setLicenseUrl(String s){
+ this.licenseUrl = s;
+ }
+ public String getLicenseUrl(){
+ return this.licenseUrl;
+ }
+
+}
\ No newline at end of file
Property changes on: content-copyright/impl/src/java/org/sakaiproject/content/copyright/CopyrightItem.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright.properties
===================================================================
--- content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright.properties (revision 0)
+++ content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright.properties (revision 0)
@@ -0,0 +1,6 @@
+public_domain=Material is in public domain.
+hold_copyright=I hold copyright.
+have_permission=I have obtained permission to use this material.
+not_determined=Copyright status is not yet determined.
+use_below=Use copyright below.
+fair_use =Material is subject to fair use exception.
Property changes on: content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright.properties
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright_es.properties
===================================================================
--- content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright_es.properties (revision 0)
+++ content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright_es.properties (revision 0)
@@ -0,0 +1,6 @@
+public_domain=El material es de dominio público.
+hold_copyright=Yo tengo el copyright.
+have_permission=Tengo permiso para utilizar este material.
+not_determined=Copyright sin determinar
+use_below=Utilice el siguiente copyright.
+fair_use = El material es fair use exception.
Property changes on: content-copyright/impl/src/bundle/org/sakaiproject/content/copyright/copyright_es.properties
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/impl/pom.xml
===================================================================
--- content-copyright/impl/pom.xml (revision 0)
+++ content-copyright/impl/pom.xml (revision 0)
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ content
+ org.sakaiproject.content
+ 2.9-SNAPSHOT
+ ../../pom.xml
+
+ sakai-content-copyright-impl
+ org.sakaiproject.content
+ content-copyright-impl
+
+ Sakai Spanish Universities
+ http://sakaiproject.org/
+
+ 2011
+ jar
+
+
+
+
+
+ org.sakaiproject.kernel
+ sakai-kernel-api
+
+
+ org.sakaiproject.kernel
+ sakai-component-manager
+
+
+ org.sakaiproject.content
+ content-copyright-api
+ ${sakai.version}
+ provided
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+
+ ${basedir}/src/bundle
+
+ **/*.properties
+
+
+
+
+
Property changes on: content-copyright/impl/pom.xml
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightManager.java
===================================================================
--- content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightManager.java (revision 0)
+++ content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightManager.java (revision 0)
@@ -0,0 +1,15 @@
+package org.sakaiproject.content.copyright.api;
+
+import java.net.URL;
+import java.util.Locale;
+
+public interface CopyrightManager {
+
+ /** Type designed to be the custom copyright type */
+ public final static String USE_THIS_COPYRIGHT = "use_below";
+
+ public CopyrightInfo getCopyrightInfo(Locale locale, String [] rights, URL serverURL);
+
+ public String getUseThisCopyright(String [] rights);
+
+}
\ No newline at end of file
Property changes on: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightManager.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightInfo.java
===================================================================
--- content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightInfo.java (revision 0)
+++ content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightInfo.java (revision 0)
@@ -0,0 +1,10 @@
+package org.sakaiproject.content.copyright.api;
+
+import java.util.List;
+
+public interface CopyrightInfo{
+
+ public void add(CopyrightItem item);
+ public List getItems();
+
+}
\ No newline at end of file
Property changes on: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightInfo.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightItem.java
===================================================================
--- content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightItem.java (revision 0)
+++ content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightItem.java (revision 0)
@@ -0,0 +1,14 @@
+package org.sakaiproject.content.copyright.api;
+
+public interface CopyrightItem {
+
+ public void setType(String s);
+ public String getType();
+
+ public void setText(String s);
+ public String getText();
+
+ public void setLicenseUrl(String s);
+ public String getLicenseUrl();
+
+}
\ No newline at end of file
Property changes on: content-copyright/api/src/java/org/sakaiproject/content/copyright/api/CopyrightItem.java
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/api/pom.xml
===================================================================
--- content-copyright/api/pom.xml (revision 0)
+++ content-copyright/api/pom.xml (revision 0)
@@ -0,0 +1,48 @@
+
+
+ 4.0.0
+
+ content
+ org.sakaiproject.content
+ 2.9-SNAPSHOT
+ ../../pom.xml
+
+ sakai-content-copyright-api
+ org.sakaiproject.content
+ content-copyright-api
+
+ Sakai Spanish Universities
+ http://sakaiproject.org/
+
+ 2011
+ jar
+
+ shared
+
+
+
+ org.sakaiproject.kernel
+ sakai-kernel-api
+
+
+ org.sakaiproject.kernel
+ sakai-component-manager
+
+
+
+
+
+ ${basedir}/src/bundle
+
+ **/*.properties
+
+
+
+ ${basedir}/src/resources
+
+ **/*.html
+
+
+
+
+
Property changes on: content-copyright/api/pom.xml
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/pack/src/webapp/WEB-INF/components.xml
===================================================================
--- content-copyright/pack/src/webapp/WEB-INF/components.xml (revision 0)
+++ content-copyright/pack/src/webapp/WEB-INF/components.xml (revision 0)
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
Property changes on: content-copyright/pack/src/webapp/WEB-INF/components.xml
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-copyright/pack/pom.xml
===================================================================
--- content-copyright/pack/pom.xml (revision 0)
+++ content-copyright/pack/pom.xml (revision 0)
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+
+ content
+ org.sakaiproject.content
+ 2.9-SNAPSHOT
+ ../../pom.xml
+
+ sakai-content-copyright-pack
+ org.sakaiproject.content
+ content-copyright-pack
+
+ Sakai Spanish Universities
+ http://sakaiproject.org/
+
+ 2011
+ sakai-component
+
+ components
+
+
+
+ org.sakaiproject.content
+ content-copyright-impl
+ ${sakai.version}
+
+
+
+
+
+
+
Property changes on: content-copyright/pack/pom.xml
___________________________________________________________________
Added: svn:eol-style
+ native
Index: content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java
===================================================================
--- content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java (revision 91004)
+++ content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java (working copy)
@@ -985,25 +985,14 @@
context.put("newcopyrightinput", rrb.getString("newcopyrightinput"));
- List copyrightValues = new ArrayList(Arrays.asList(rrb.getStrings("copyrighttype")));
+ org.sakaiproject.content.copyright.api.CopyrightManager copyrightManager = (org.sakaiproject.content.copyright.api.CopyrightManager) ComponentManager.get("org.sakaiproject.content.copyright.api.CopyrightManager");
+ org.sakaiproject.content.copyright.api.CopyrightInfo copyrightInfo = copyrightManager.getCopyrightInfo(new ResourceLoader().getLocale(),rrb.getStrings("copyrighttype"),ResourcesAction.class.getResource("ResourcesAction.class"));
+ List copyrightTypes = copyrightInfo.getItems();
- Hashtable copyrightTypes = new Hashtable();
-
- int len = copyrightValues.size();
-
- for (int i=0;i v = new Vector(copyrightTypes.keySet());
- Collections.sort(v);
-
- context.put("copyrightTypes", copyrightTypes);
- context.put("copyrightKeys", v);
- context.put("copyrightTypesSize", rrb.getString("copyrighttype.count"));
- context.put("USE_THIS_COPYRIGHT", copyrightTypes.get(copyrightTypes.size() - 1));
+ context.put("copyrightTypes", copyrightTypes);
+ context.put("copyrightTypesSize", copyrightTypes.size());
+ context.put("USE_THIS_COPYRIGHT", copyrightManager.getUseThisCopyright(rrb.getStrings("copyrighttype")));
+
}
} // copyrightChoicesIntoContext
Index: content-tool/tool/src/webapp/vm/resources/sakai_properties.vm
===================================================================
--- content-tool/tool/src/webapp/vm/resources/sakai_properties.vm (revision 91004)
+++ content-tool/tool/src/webapp/vm/resources/sakai_properties.vm (working copy)
@@ -117,22 +117,20 @@
$tlang.getString("cright.status")
- #if ($!fairuseurl)
- ( [$tlang.getString('cright.newwin')]$tlang.getString("cright.fairuse"))
- #end
+ ( [$tlang.getString('cright.newwin')]$tlang.getString('cright.fairuse'))
-
+
*