Code

Applied patches for default metadata and for fix on creative commons namespace.
authorkidproto <kidproto@users.sourceforge.net>
Tue, 14 Aug 2007 07:22:11 +0000 (07:22 +0000)
committerkidproto <kidproto@users.sourceforge.net>
Tue, 14 Aug 2007 07:22:11 +0000 (07:22 +0000)
src/dialogs/rdf.cpp
src/preferences-skeleton.h
src/xml/repr-util.cpp
src/xml/repr.h

index a145e08348448b913cafb80ac37801207a02b06e..cf3cd581f8d45ed6d90d0e3a59dd8cdb94c3f8b3 100644 (file)
 #include "xml/repr.h"
 #include "rdf.h"
 #include "sp-item-group.h"
+#include "prefs-utils.h"
 
 /*
 
    Example RDF XML from various places...
  
-<rdf:RDF xmlns="http://web.resource.org/cc/"
+<rdf:RDF xmlns="http://creativecommons.org/ns#"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <Work rdf:about="">
@@ -48,7 +49,7 @@
 </Work>
 
 
-  <rdf:RDF xmlns="http://web.resource.org/cc/"
+  <rdf:RDF xmlns="http://creativecommons.org/ns#"
       xmlns:dc="http://purl.org/dc/elements/1.1/"
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
   <Work rdf:about="">
         <dc:title>John Cliff</dc:title>
      </Agent></dc:rights>
      <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-     <license rdf:resource="http://web.resource.org/cc/PublicDomain" />
+     <license rdf:resource="http://creativecommons.org/ns#PublicDomain" />
   </Work>
   
-  <License rdf:about="http://web.resource.org/cc/PublicDomain">
-     <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" />
+  <License rdf:about="http://creativecommons.org/ns#PublicDomain">
+     <permits rdf:resource="http://creativecommons.org/ns#Reproduction" />
+     <permits rdf:resource="http://creativecommons.org/ns#Distribution" />
+     <permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
   </License>
   
 </rdf:RDF>
@@ -91,76 +92,76 @@ struct rdf_double_t rdf_license_empty [] = {
 };
 
 struct rdf_double_t rdf_license_cc_a [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_cc_a_sa [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
-    { "cc:requires", "http://web.resource.org/cc/ShareAlike", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
+    { "cc:requires", "http://creativecommons.org/ns#ShareAlike", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_cc_a_nd [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_cc_a_nc [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
-    { "cc:prohibits", "http://web.resource.org/cc/CommercialUse", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
+    { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_cc_a_nc_sa [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
-    { "cc:prohibits", "http://web.resource.org/cc/CommercialUse", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
-    { "cc:requires", "http://web.resource.org/cc/ShareAlike", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
+    { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
+    { "cc:requires", "http://creativecommons.org/ns#ShareAlike", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_cc_a_nc_nd [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
-    { "cc:prohibits", "http://web.resource.org/cc/CommercialUse", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
+    { "cc:prohibits", "http://creativecommons.org/ns#CommercialUse", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_pd [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
     { NULL, NULL }
 };
 
 struct rdf_double_t rdf_license_freeart [] = {
-    { "cc:permits", "http://web.resource.org/cc/Reproduction", },
-    { "cc:permits", "http://web.resource.org/cc/Distribution", },
-    { "cc:permits", "http://web.resource.org/cc/DerivativeWorks", },
-    { "cc:requires", "http://web.resource.org/cc/ShareAlike", },
-    { "cc:requires", "http://web.resource.org/cc/Notice", },
-    { "cc:requires", "http://web.resource.org/cc/Attribution", },
+    { "cc:permits", "http://creativecommons.org/ns#Reproduction", },
+    { "cc:permits", "http://creativecommons.org/ns#Distribution", },
+    { "cc:permits", "http://creativecommons.org/ns#DerivativeWorks", },
+    { "cc:requires", "http://creativecommons.org/ns#ShareAlike", },
+    { "cc:requires", "http://creativecommons.org/ns#Notice", },
+    { "cc:requires", "http://creativecommons.org/ns#Attribution", },
     { NULL, NULL }
 };
 
@@ -339,7 +340,7 @@ rdf_string(struct rdf_t * rdf)
     gchar *string=NULL;
 
     gchar *rdf_head="\
-<rdf:RDF xmlns=\"http://web.resource.org/cc/\"\
+<rdf:RDF xmlns=\"http://creativecommons.org/ns#\"\
     xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\
     xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\
 ";
@@ -976,6 +977,20 @@ struct rdf_entity_default_t {
 struct rdf_entity_default_t rdf_defaults[] = {
     { "format",      "image/svg+xml", },
     { "type",        "http://purl.org/dc/dcmitype/StillImage", },
+    { "title",       "", },
+    { "date",        "", },
+    { "creator",     "", },
+    { "rights",      "", },
+    { "publisher",   "", },
+    { "identifier",  "", },
+    { "source",      "", },
+    { "relation",    "", },
+    { "language",    "", },
+    { "subject",     "", },
+    { "coverage",    "", },
+    { "description", "", },
+    { "contributor", "", },
+    { "license_uri", "", },
     { NULL,          NULL, }
 };
 
@@ -1004,8 +1019,11 @@ rdf_set_defaults ( SPDocument * doc )
         struct rdf_work_entity_t * entity = rdf_find_entity ( rdf_default->name );
         g_assert ( entity != NULL );
 
+        //get default matedata defined by user preferences
+        const gchar * text = prefs_get_string_attribute ("options.defaultmetadata", rdf_default->name);
+
         if ( rdf_get_work_entity ( doc, entity ) == NULL ) {
-            rdf_set_work_entity ( doc, entity, rdf_default->text );
+            rdf_set_work_entity ( doc, entity, text ? text : rdf_default->text );
         }
     }
 }
index 8a04640e1c9518a164a859e3ed18d7f57bbab1e6..d6fea990d81d3af23af10a6ed4fceb863b16c6da 100644 (file)
@@ -208,6 +208,7 @@ static char const preferences_skeleton[] =
 "    <group id=\"transform\" stroke=\"1\" rectcorners=\"1\" pattern=\"1\" gradient=\"1\" />\n"
 "    <group id=\"kbselection\" inlayer=\"1\" onlyvisible=\"1\" onlysensitive=\"1\" />\n"
 "    <group id=\"selection\" layerdeselect=\"1\" />\n"
+"    <group id=\"defaultmetadata\" title=\"\" date=\"\" format=\"\" type=\"\" creator=\"\" rights=\"\" publisher=\"\" identifier=\"\" source=\"\" relation=\"\" language=\"\" subject=\"\" coverage=\"\" description=\"\" contributor=\"\" license=\"0\" license_uri=\"\" inkscapedefaults=\"1\" />\n"
 "    <group id=\"createbitmap\"/>\n"
 "    <group id=\"compassangledisplay\" value=\"0\"/>\n"
 "    <group id=\"maskobject\" topmost=\"1\" remove=\"1\"/>\n"
index 42b957d438da11b857b5266032c5a9ee68d1b9bd..693558cf766ee07f19fcae63c89e5f5bd2f4cc5c 100644 (file)
@@ -149,7 +149,7 @@ static SPXMLNs *namespaces=NULL;
 static void
 sp_xml_ns_register_defaults()
 {
-    static SPXMLNs defaults[9];
+    static SPXMLNs defaults[10];
 
     defaults[0].uri = g_quark_from_static_string(SP_SODIPODI_NS_URI);
     defaults[0].prefix = g_quark_from_static_string("sodipodi");
@@ -194,7 +194,13 @@ sp_xml_ns_register_defaults()
 
     defaults[8].uri = g_quark_from_static_string("http://inkscape.sourceforge.net/DTD/s odipodi-0.dtd");
     defaults[8].prefix = g_quark_from_static_string("sodipodi");
-    defaults[8].next = NULL;
+    defaults[8].next = &defaults[9];
+
+    // This namespace URI is being phased out by Creative Commons
+
+    defaults[9].uri = g_quark_from_static_string(SP_OLD_CC_NS_URI);
+    defaults[9].prefix = g_quark_from_static_string("cc");
+    defaults[9].next = NULL;
 
     namespaces = &defaults[0];
 }
index 89221656a1bd14377a13ffe57ce8598a3e0905f7..23786d3b80076170dcd9a21da3be06ee6efc6eff 100644 (file)
@@ -27,7 +27,8 @@
 #define SP_XLINK_NS_URI "http://www.w3.org/1999/xlink"
 #define SP_SVG_NS_URI "http://www.w3.org/2000/svg"
 #define SP_RDF_NS_URI "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-#define SP_CC_NS_URI "http://web.resource.org/cc/"
+#define SP_CC_NS_URI "http://creativecommons.org/ns#"
+#define SP_OLD_CC_NS_URI "http://web.resource.org/cc/"
 #define SP_DC_NS_URI "http://purl.org/dc/elements/1.1/"
 
 /**