From 43e02466371c79db2f358e832468406346d48c8b Mon Sep 17 00:00:00 2001 From: bshuttle Date: Fri, 2 Dec 2005 11:01:58 +0000 Subject: [PATCH] conditional metadata didn't work. surprise. --- lib/metadata/metadatautil.inc.php | 9 ++++++++- presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js | 4 +++- templates/kt3/fieldsets/conditional_editable.smarty | 4 ++++ templates/ktcore/document/add.smarty | 5 ++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/metadata/metadatautil.inc.php b/lib/metadata/metadatautil.inc.php index 600f024..e7182e5 100644 --- a/lib/metadata/metadatautil.inc.php +++ b/lib/metadata/metadatautil.inc.php @@ -136,7 +136,14 @@ class KTMetadataUtil { $oMasterField =& DocumentField::get($oFieldset->getMasterFieldId()); $aSelectedFields = array_keys($aCurrentSelections); - $oValueInstance = KTValueInstance::getByLookupSingle($aCurrentSelections[$oMasterField->getId()]); + + $field = $oMasterField->getId(); + $val = $aCurrentSelections[$field]; + $lookup = MetaData::getByValueAndDocumentField($val, $field); + + $oValueInstance = KTValueInstance::getByLookupSingle($lookup); + + $aValues = KTMetadataUtil::_getNextForBehaviour($oValueInstance->getBehaviourId(), $aCurrentSelections); $GLOBALS['default']->log->debug('KTMetadataUtil::getNext, values are ' . print_r($aValues, true)); diff --git a/presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js b/presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js index 9bae4a8..ea5b90a 100644 --- a/presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js +++ b/presentation/lookAndFeel/knowledgeTree/js/conditional_usage.js @@ -3,6 +3,7 @@ function getBindTarget(fieldset) { var possibles = getElementsByTagAndClassName('DIV','conditional_target', fieldset); + return possibles[0]; } @@ -272,7 +273,8 @@ function clearUnfixedWidgets(fieldset) { */ function updateFieldset(fieldset) { - var targeturl = '/presentation/lookAndFeel/knowledgeTree/ajaxConditional.php'; // test_metadata_update.txt'; + var baseurl = getElement('kt-core-baseurl').value; + var targeturl = baseurl + '/presentation/lookAndFeel/knowledgeTree/ajaxConditional.php'; // test_metadata_update.txt'; simpleLog('DEBUG','AJAX function called: updateFieldset'); var formdata = parseFieldsetToForm(fieldset); diff --git a/templates/kt3/fieldsets/conditional_editable.smarty b/templates/kt3/fieldsets/conditional_editable.smarty index 705ef3e..9c29b0f 100644 --- a/templates/kt3/fieldsets/conditional_editable.smarty +++ b/templates/kt3/fieldsets/conditional_editable.smarty @@ -10,3 +10,7 @@ + \ No newline at end of file diff --git a/templates/ktcore/document/add.smarty b/templates/ktcore/document/add.smarty index c8fca79..030ff3e 100644 --- a/templates/ktcore/document/add.smarty +++ b/templates/ktcore/document/add.smarty @@ -14,7 +14,9 @@ {capture assign=sJavascript} {literal} function swapInItem(elementId, req) { + var cp = getElement(elementId); + cp.innerHTML = req.responseText; initialiseConditionalFieldsets(); } @@ -28,11 +30,12 @@ function swapElementFromRequest(elementId, url) { deff.addCallback(partial(swapInItem, elementId)); var cp = getElement(elementId); cp.innerHTML="loading..."; + } function getMetadataForType(id) { swapElementFromRequest('type_metadata_fields', - 'http://{/literal}{$config->get('KnowledgeTree/serverName')}{literal}/presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php?fDocumentTypeID=' + '{/literal}{$rootUrl}{literal}/presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php?fDocumentTypeID=' + id); } -- libgit2 0.21.4