From 09484545541e5258d2cdd7e73a4b55d0687b76db Mon Sep 17 00:00:00 2001 From: kidproto Date: Tue, 14 Aug 2007 07:22:11 +0000 Subject: [PATCH] Applied patches for default metadata and for fix on creative commons namespace. --- src/dialogs/rdf.cpp | 120 +++++++++++++++++++++---------------- src/preferences-skeleton.h | 1 + src/xml/repr-util.cpp | 10 +++- src/xml/repr.h | 3 +- 4 files changed, 80 insertions(+), 54 deletions(-) diff --git a/src/dialogs/rdf.cpp b/src/dialogs/rdf.cpp index a145e0834..cf3cd581f 100644 --- a/src/dialogs/rdf.cpp +++ b/src/dialogs/rdf.cpp @@ -23,12 +23,13 @@ #include "xml/repr.h" #include "rdf.h" #include "sp-item-group.h" +#include "prefs-utils.h" /* Example RDF XML from various places... - @@ -48,7 +49,7 @@ - @@ -57,13 +58,13 @@ John Cliff - + - - - - + + + + @@ -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="\ -\ "; @@ -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 ); } } } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 8a04640e1..d6fea990d 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -208,6 +208,7 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 42b957d43..693558cf7 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -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]; } diff --git a/src/xml/repr.h b/src/xml/repr.h index 89221656a..23786d3b8 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -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/" /** -- 2.30.2