Commit 622dfd0a2fe0dbbe1dc9f7158ff16b6dcc5a2d60
1 parent
3b4507d9
Asynchronous javascript function to render the metadata fields for a
specific document type without reloading the page. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3655 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
43 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +require_once('../../../../config/dmsDefaults.php'); | |
| 4 | + | |
| 5 | +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | |
| 6 | +require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | |
| 7 | +require_once(KT_LIB_DIR . '/documentmanagement/DocumentField.inc'); | |
| 8 | + | |
| 9 | +require_once(KT_LIB_DIR . '/visualpatterns/PatternMetaData.inc'); | |
| 10 | + | |
| 11 | +class GetTypeMetadataFieldsDispatcher extends KTDispatcher { | |
| 12 | + function do_main() { | |
| 13 | + return $this->getTypeMetadataFields($_REQUEST['fDocumentTypeID']); | |
| 14 | + } | |
| 15 | + | |
| 16 | + function getTypeMetadataFields ($iDocumentTypeID) { | |
| 17 | + /*ok*/ $sQuery = array("SELECT DF.id AS id " . | |
| 18 | + "FROM document_fields AS DF LEFT JOIN document_type_fields_link AS DTFL ON DTFL.field_id = DF.id " . | |
| 19 | + "WHERE DF.is_generic = ? " . | |
| 20 | + "AND DTFL.document_type_id = ?", array(false, $iDocumentTypeID)); | |
| 21 | + | |
| 22 | + $aIDs = DBUtil::getResultArray($sQuery); | |
| 23 | + | |
| 24 | + $aFields = array(); | |
| 25 | + foreach ($aIDs as $iID) { | |
| 26 | + $aFields[] =& call_user_func(array('DocumentField', 'get'), $iID); | |
| 27 | + } | |
| 28 | + $aTemplateData = array( | |
| 29 | + 'caption' => _('Type specific meta data'), | |
| 30 | + 'empty_message' => _("No Type Specific Meta Data"), | |
| 31 | + 'fields' => $aFields, | |
| 32 | + ); | |
| 33 | + $oTemplating = KTTemplating::getSingleton(); | |
| 34 | + $oTemplate = $oTemplating->loadTemplate("ktcore/metadata_fields/editable_metadata_fields"); | |
| 35 | + return $oTemplate->render($aTemplateData); | |
| 36 | + } | |
| 37 | +} | |
| 38 | + | |
| 39 | +$f =& new GetTypeMetadataFieldsDispatcher; | |
| 40 | +$f->dispatch(); | |
| 41 | + | |
| 42 | + | |
| 43 | +?> | ... | ... |