Commit 5cb5232f5cef439f068b59d2458cc6b07bb42eaf
1 parent
fcd4ccf3
If the document field is a lookup, provide a drop-down box with the
lookup values. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3147 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
20 additions
and
0 deletions
lib/browse/Criteria.inc
| @@ -2,7 +2,9 @@ | @@ -2,7 +2,9 @@ | ||
| 2 | require_once("$default->fileSystemRoot/lib/security/Permission.inc"); | 2 | require_once("$default->fileSystemRoot/lib/security/Permission.inc"); |
| 3 | require_once("$default->fileSystemRoot/lib/users/User.inc"); | 3 | require_once("$default->fileSystemRoot/lib/users/User.inc"); |
| 4 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | 4 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); |
| 5 | +require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | ||
| 5 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | 6 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); |
| 7 | +require_once("$default->fileSystemRoot/lib/documentmanagement/MetaData.inc"); | ||
| 6 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 8 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 7 | /** | 9 | /** |
| 8 | * $Id$ | 10 | * $Id$ |
| @@ -343,6 +345,7 @@ class GenericMetadataCriterion extends BrowseCriterion { | @@ -343,6 +345,7 @@ class GenericMetadataCriterion extends BrowseCriterion { | ||
| 343 | function GenericMetadataCriterion ($sDisplay, $sDocumentField, $sSortField, $iID) { | 345 | function GenericMetadataCriterion ($sDisplay, $sDocumentField, $sSortField, $iID) { |
| 344 | $this->BrowseCriterion($sDisplay, $sDocumentField, $sSortField, $iID); | 346 | $this->BrowseCriterion($sDisplay, $sDocumentField, $sSortField, $iID); |
| 345 | $this->aLookup['whereClause'] = 'document_field_id = ' . $iID; | 347 | $this->aLookup['whereClause'] = 'document_field_id = ' . $iID; |
| 348 | + $this->oField =& DocumentField::get($iID); | ||
| 346 | } | 349 | } |
| 347 | 350 | ||
| 348 | function documentDisplay ($oDocument) { | 351 | function documentDisplay ($oDocument) { |
| @@ -370,6 +373,23 @@ class GenericMetadataCriterion extends BrowseCriterion { | @@ -370,6 +373,23 @@ class GenericMetadataCriterion extends BrowseCriterion { | ||
| 370 | function getSearchField () { | 373 | function getSearchField () { |
| 371 | return $this->aLookup['field']; | 374 | return $this->aLookup['field']; |
| 372 | } | 375 | } |
| 376 | + | ||
| 377 | + function searchWidget ($aRequest) { | ||
| 378 | + // If there's no lookup, just use the standard text input | ||
| 379 | + if ($this->oField->getHasLookup() === false) { | ||
| 380 | + return parent::searchWidget($aRequest); | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + $sRet = "<select size=\"1\" name=\"" . $this->getWidgetBase() . "\">\n"; | ||
| 384 | + $aSearch = array('document_field_id = ?', $this->getID()); | ||
| 385 | + $aMetaData = MetaData::getList($aSearch);/*ok*/ | ||
| 386 | + $sRet .= "<option value=\"-1\">None</option>\n"; | ||
| 387 | + foreach ($aMetaData as $oMetaData) { | ||
| 388 | + $sRet .= "<option value=\"" . $oMetaData->getName() . "\">" . $oMetaData->getName() . "</option>\n"; | ||
| 389 | + } | ||
| 390 | + $sRet .= "</select>\n"; | ||
| 391 | + return $sRet; | ||
| 392 | + } | ||
| 373 | } | 393 | } |
| 374 | 394 | ||
| 375 | class Criteria { | 395 | class Criteria { |