function &getHardCodedMetadataFromLabel($label, $value = null)
 {
     $md = null;
     switch ($label) {
         case 'title':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_title_name'));
             $md->setLabel('title');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_title_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_STRING);
             $md->setIsRequired(true);
             $md->setIsEmptyAllowed(false);
             $md->setKeepHistory(false);
             $md->setUseIt(true);
             $md->setCanChangeValue(true);
             break;
         case 'description':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_desc_name'));
             $md->setLabel('description');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_desc_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_TEXT);
             $md->setIsRequired(true);
             $md->setIsEmptyAllowed(true);
             $md->setKeepHistory(false);
             $md->setUseIt(true);
             $md->setCanChangeValue(true);
             break;
         case 'owner':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_owner_name'));
             $md->setLabel('owner');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_owner_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_STRING);
             $md->setIsRequired(true);
             $md->setIsEmptyAllowed(true);
             $md->setKeepHistory(true);
             $md->setUseIt(true);
             $md->setCanChangeValue(true);
             break;
         case 'create_date':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_cdate_name'));
             $md->setLabel('create_date');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_cdate_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
             $md->setIsRequired(true);
             $md->setIsEmptyAllowed(false);
             $md->setKeepHistory(true);
             $md->setUseIt(true);
             $md->setCanChangeValue(false);
             break;
         case 'update_date':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_udate_name'));
             $md->setLabel('update_date');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_udate_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
             $md->setIsRequired(true);
             $md->setIsEmptyAllowed(false);
             $md->setKeepHistory(true);
             $md->setUseIt(true);
             $md->setCanChangeValue(false);
             break;
         case 'status':
             $md = new Docman_ListMetadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_status_name'));
             $md->setLabel('status');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_status_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_LIST);
             $md->setIsRequired(false);
             $md->setIsEmptyAllowed(true);
             $md->setKeepHistory(true);
             $md->setCanChangeValue(true);
             $md->setDefaultValue(PLUGIN_DOCMAN_ITEM_STATUS_NONE);
             break;
         case 'obsolescence_date':
             $md = new Docman_Metadata();
             $md->setName($GLOBALS['Language']->getText('plugin_docman', 'md_odate_name'));
             $md->setLabel('obsolescence_date');
             $md->setDescription($GLOBALS['Language']->getText('plugin_docman', 'md_odate_desc'));
             $md->setType(PLUGIN_DOCMAN_METADATA_TYPE_DATE);
             $md->setIsRequired(false);
             $md->setIsEmptyAllowed(true);
             $md->setKeepHistory(false);
             $md->setCanChangeValue(true);
             $md->setDefaultValue(0);
             break;
     }
     if ($md !== null) {
         $md->setValue($value);
         $md->setSpecial(true);
         $md->setCanChangeName(false);
         $md->setCanChangeIsEmptyAllowed(false);
         $md->setCanChangeDescription(false);
         $md->setGroupId($this->groupId);
     }
     return $md;
 }
 /**
  * Return form to create a new metadata
  */
 function getNewMetadataForm($groupId)
 {
     $content = '';
     $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_new_title') . '</h3>' . "\n";
     $content .= '<form name="admin_create_metadata" method="post" action="?group_id=' . $groupId . '&action=admin_create_metadata" class="docman_form">';
     $content .= '<table>';
     $md = new Docman_Metadata();
     $md->setCanChangeName(true);
     $md->setCanChangeType(true);
     $md->setCanChangeDescription(true);
     $md->setCanChangeIsEmptyAllowed(true);
     $md->setCanChangeIsMultipleValuesAllowed(true);
     $md->setIsEmptyAllowed(true);
     $md->setIsMultipleValuesAllowed(false);
     $sthCanChange = '';
     $metaMdHtml = new Docman_MetaMetadataHtml($md);
     $content .= $metaMdHtml->getName($sthCanChange);
     $content .= $metaMdHtml->getDescription($sthCanChange);
     $content .= $metaMdHtml->getType($sthCanChange);
     $content .= $metaMdHtml->getEmptyAllowed($sthCanChange);
     $content .= $metaMdHtml->getMultipleValuesAllowed($sthCanChange);
     $content .= $metaMdHtml->getUseIt($sthCanChange);
     $content .= '<tr>';
     $content .= '<td colspan="2">';
     $content .= '<input name="submit" type="submit" value="' . $GLOBALS['Language']->getText('plugin_docman', 'admin_metadata_new_submit') . '" />';
     $content .= '</td>';
     $content .= '</tr>';
     $content .= '</table>';
     $content .= '</form>';
     return $content;
 }