Commit a9229e93412d28334f41de0ebce0c642de9c1982
1 parent
f41e54ee
Pass current values to the template that renders the editable metadata
fields for a document (type). git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3648 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
10 additions
and
2 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/modifySpecificMetaDataUI.inc
| @@ -35,16 +35,22 @@ function getEditableTypeSpecificMetaData($iDocumentID, $iDocumentTypeID) { | @@ -35,16 +35,22 @@ function getEditableTypeSpecificMetaData($iDocumentID, $iDocumentTypeID) { | ||
| 35 | "WHERE DF.is_generic = ? " . | 35 | "WHERE DF.is_generic = ? " . |
| 36 | "AND DTFL.document_type_id = ?", array(false, $iDocumentTypeID)); | 36 | "AND DTFL.document_type_id = ?", array(false, $iDocumentTypeID)); |
| 37 | 37 | ||
| 38 | - $aIDs = DBUtil::getResultArray($sQuery); | 38 | + $aIDs = DBUtil::getResultArrayKey($sQuery, 'id'); |
| 39 | 39 | ||
| 40 | $aFields = array(); | 40 | $aFields = array(); |
| 41 | + $aValues = array(); | ||
| 41 | foreach ($aIDs as $iID) { | 42 | foreach ($aIDs as $iID) { |
| 42 | $aFields[] =& call_user_func(array('DocumentField', 'get'), $iID); | 43 | $aFields[] =& call_user_func(array('DocumentField', 'get'), $iID); |
| 44 | + $aValues[$iID] = DBUtil::getOneResultKey(array( | ||
| 45 | + "SELECT value FROM document_fields_link WHERE document_id = ? AND document_field_id = ?", | ||
| 46 | + array($iDocumentID, $iID), | ||
| 47 | + ), 'value'); | ||
| 43 | } | 48 | } |
| 44 | $aTemplateData = array( | 49 | $aTemplateData = array( |
| 45 | 'caption' => _('Type specific meta data'), | 50 | 'caption' => _('Type specific meta data'), |
| 46 | 'empty_message' => _("No Type Specific Meta Data"), | 51 | 'empty_message' => _("No Type Specific Meta Data"), |
| 47 | 'fields' => $aFields, | 52 | 'fields' => $aFields, |
| 53 | + 'values' => $aValues, | ||
| 48 | ); | 54 | ); |
| 49 | $oTemplating = KTTemplating::getSingleton(); | 55 | $oTemplating = KTTemplating::getSingleton(); |
| 50 | $oTemplate = $oTemplating->loadTemplate("ktcore/metadata_fields/editable_metadata_fields"); | 56 | $oTemplate = $oTemplating->loadTemplate("ktcore/metadata_fields/editable_metadata_fields"); |
templates/ktcore/metadata_fields/editable_metadata_fields.smarty
| @@ -55,7 +55,9 @@ | @@ -55,7 +55,9 @@ | ||
| 55 | {php} | 55 | {php} |
| 56 | $oField = $this->_tpl_vars['oField']; | 56 | $oField = $this->_tpl_vars['oField']; |
| 57 | $sPrefix = $this->_tpl_vars['metadata_prefix']; | 57 | $sPrefix = $this->_tpl_vars['metadata_prefix']; |
| 58 | -$this->assign('pattern', new PatternMetadata($oField->getName(), $sPrefix . $oField->getID())); | 58 | +$sValue = $this->_tpl_vars['values'][$oField->getID()]; |
| 59 | +$this->assign('pattern', | ||
| 60 | + new PatternMetadata($oField->getName(), $sPrefix . $oField->getID(), $sValue)); | ||
| 59 | {/php} | 61 | {/php} |
| 60 | {$pattern->render()} | 62 | {$pattern->render()} |
| 61 | </td> | 63 | </td> |