diff --git a/livesupport/modules/core/etc/metadataType.xml b/livesupport/modules/core/etc/metadataType.xml
index 7f23c8604..2a3ded6fb 100644
--- a/livesupport/modules/core/etc/metadataType.xml
+++ b/livesupport/modules/core/etc/metadataType.xml
@@ -5,11 +5,13 @@
+
]>
diff --git a/livesupport/modules/core/etc/metadataTypeContainer.xml b/livesupport/modules/core/etc/metadataTypeContainer.xml
index f1d49e1e3..7ebdf1f30 100644
--- a/livesupport/modules/core/etc/metadataTypeContainer.xml
+++ b/livesupport/modules/core/etc/metadataTypeContainer.xml
@@ -5,6 +5,7 @@
+
@@ -14,6 +15,7 @@
*
*
+ * The tab attribute (if present) must be one of "main", "music" or "talk"
+ * (all lowercase, case sensitive).
+ * This determines whether, at file upload, the metadata field appears in
+ * the Main, Music, or Talk tab. If the attribute is omitted, the metadata
+ * field will appear in none of the tabs.
+ *
* The DTD for the expected XML element looks like the following:
*
*
@@ -81,16 +88,27 @@ class MetadataTypeContainer;
*
*
*
+ *
*
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @see MetadataTypeContainer
*/
class MetadataType : public Configurable
{
friend class MetadataTypeContainer;
+
+ public:
+ /**
+ * An enumeration of all possible metadata categories.
+ */
+ typedef enum { noTab,
+ mainTab,
+ musicTab,
+ talkTab } TabType;
+
private:
/**
@@ -118,6 +136,11 @@ class MetadataType : public Configurable
*/
Ptr::Ref localizationKey;
+ /**
+ * The localization key for this metadata type.
+ */
+ TabType tab;
+
protected:
/**
@@ -140,7 +163,8 @@ class MetadataType : public Configurable
MetadataType(Ptr::Ref container,
Glib::ustring dcName,
Glib::ustring id3Tag,
- Glib::ustring localizationKey)
+ Glib::ustring localizationKey,
+ TabType tab = noTab)
throw ();
/**
@@ -219,6 +243,18 @@ class MetadataType : public Configurable
*/
Ptr::Ref
getLocalizedName(void) const throw (std::invalid_argument);
+
+ /**
+ * Return the tab that this metadata type should appear in,
+ * when an audio clip is uploaded in the Studio client.
+ *
+ * @return the name of the tab for the metadata type.
+ */
+ TabType
+ getTab(void) const throw ()
+ {
+ return tab;
+ }
};
diff --git a/livesupport/modules/core/src/MetadataType.cxx b/livesupport/modules/core/src/MetadataType.cxx
index 5634e02c0..961923610 100644
--- a/livesupport/modules/core/src/MetadataType.cxx
+++ b/livesupport/modules/core/src/MetadataType.cxx
@@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Author : $Author: maroy $
- Version : $Revision: 1.1 $
+ Author : $Author: fgerlits $
+ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataType.cxx,v $
------------------------------------------------------------------------------*/
@@ -65,6 +65,11 @@ static const std::string id3TagAttrName = "id3Tag";
*/
static const std::string localizationKeyAttrName = "localizationKey";
+/**
+ * The name of the attribute of the tab name in the metadataType element
+ */
+static const std::string tabAttrName = "tab";
+
/* =============================================== local function prototypes */
@@ -76,8 +81,9 @@ static const std::string localizationKeyAttrName = "localizationKey";
*----------------------------------------------------------------------------*/
MetadataType :: MetadataType(Ptr::Ref container)
throw ()
+ : container(container),
+ tab(noTab)
{
- this->container = container;
}
@@ -87,10 +93,12 @@ MetadataType :: MetadataType(Ptr::Ref container)
MetadataType :: MetadataType(Ptr::Ref container,
Glib::ustring dcName,
Glib::ustring id3Tag,
- Glib::ustring localizationKey)
+ Glib::ustring localizationKey,
+ TabType tab)
throw ()
+ : container(container),
+ tab(tab)
{
- this->container = container;
this->dcName.reset(new Glib::ustring(dcName));
this->id3Tag.reset(new Glib::ustring(id3Tag));
this->localizationKey.reset(new Glib::ustring(localizationKey));
@@ -128,6 +136,19 @@ MetadataType :: configure(const xmlpp::Element & element)
+ localizationKeyAttrName);
}
localizationKey.reset(new Glib::ustring(attribute->get_value()));
+
+ // get the tab, optional
+ tab = noTab;
+ if ((attribute = element.get_attribute(tabAttrName))) {
+ Glib::ustring tabString = attribute->get_value();
+ if (tabString == "main") {
+ tab = mainTab;
+ } else if (tabString == "music") {
+ tab = musicTab;
+ } else if (tabString == "talk") {
+ tab = talkTab;
+ }
+ }
}
diff --git a/livesupport/modules/core/src/MetadataTypeContainerTest.cxx b/livesupport/modules/core/src/MetadataTypeContainerTest.cxx
index c9fd7bd60..a7e42b122 100644
--- a/livesupport/modules/core/src/MetadataTypeContainerTest.cxx
+++ b/livesupport/modules/core/src/MetadataTypeContainerTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.3 $
+ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataTypeContainerTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -203,6 +203,15 @@ MetadataTypeContainerTest :: firstTest(void)
gotException = true;
}
CPPUNIT_ASSERT(gotException);
+
+ // two simple positive checks on the tab attribute
+ CPPUNIT_ASSERT(container->existsByDcName("dc:title"));
+ metadataType = container->getByDcName("dc:title");
+ CPPUNIT_ASSERT(metadataType->getTab() == MetadataType::mainTab);
+
+ CPPUNIT_ASSERT(container->existsByDcName("ls:buycdurl"));
+ metadataType = container->getByDcName("ls:buycdurl");
+ CPPUNIT_ASSERT(metadataType->getTab() == MetadataType::noTab);
}