From 043e6837cf591eeae2ce284483a0d84893b371d8 Mon Sep 17 00:00:00 2001 From: Kevin G Fourie Date: Mon, 7 Sep 2009 17:42:14 +0200 Subject: [PATCH] Removed extraneous text from MultiSelect plugin. --- lib/documentmanagement/DocumentField.inc | 404 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- lib/metadata/fieldsetregistry.inc.php | 246 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------- lib/search/searchutil.inc.php | 422 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- lib/widgets/fieldsetDisplay.inc.php | 50 +++++++++++++++++++++++++------------------------- plugins/ktcore/document/edit.php | 12 ++++++------ plugins/multiselect/BulkImport.php | 2 +- plugins/multiselect/BulkUpload.php | 2 +- plugins/multiselect/MultiSelectPlugin.php | 6 +++--- plugins/multiselect/inetbasic.inc.php | 2 +- 9 files changed, 573 insertions(+), 573 deletions(-) diff --git a/lib/documentmanagement/DocumentField.inc b/lib/documentmanagement/DocumentField.inc index 0ec7918..fc71d96 100755 --- a/lib/documentmanagement/DocumentField.inc +++ b/lib/documentmanagement/DocumentField.inc @@ -78,7 +78,7 @@ class DocumentField extends KTEntity { var $_aFieldToSelect = array( 'iId' => 'id', 'sName' => 'name', - 'sDescription' => 'description', + 'sDescription' => 'description', 'sDataType' => 'data_type', 'bIsGeneric' => 'is_generic', 'bHasLookup' => 'has_lookup', @@ -93,63 +93,63 @@ class DocumentField extends KTEntity { ); // FIXME deprecate constructor use. Use DocumentField::createFromArray instead. - function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null, $bNewIsHTML = null, $iNewMaxLength = null, $bHasNewInetLookup = null, $sNewInetLookupType = null) { - - $this->iId = -1; - $this->sName = $sNewName; - $this->sDataType = $sNewDataType; - $this->bIsGeneric = $bNewIsGeneric; - $this->bHasLookup = $bNewHasLookup; - $this->iParentFieldset = $iParentFieldset; - $this->bHasLookupTree = $bHasLookupTree; - $this->iPosition = $this->getNextFieldPosition($iParentFieldset); - $this->bIsHTML = $bNewIsHTML; - $this->iMax = $iNewMaxLength; - $this->sInetLookupType = $bHasNewInetLookup; - $this->sInetLookupType = $sNewInetLookupType; - } - - function getID() { return $this->iId; } - function getName() { return $this->sName; } - function setName($sNewValue) { $this->sName = $sNewValue; } - function setDescription($sNewValue) { $this->sDescription = $sNewValue; } - function getDescription() { return $this->sDescription; } - function getDataType() { return $this->sDataType; } + function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null, $bNewIsHTML = null, $iNewMaxLength = null, $bHasNewInetLookup = null, $sNewInetLookupType = null) { + + $this->iId = -1; + $this->sName = $sNewName; + $this->sDataType = $sNewDataType; + $this->bIsGeneric = $bNewIsGeneric; + $this->bHasLookup = $bNewHasLookup; + $this->iParentFieldset = $iParentFieldset; + $this->bHasLookupTree = $bHasLookupTree; + $this->iPosition = $this->getNextFieldPosition($iParentFieldset); + $this->bIsHTML = $bNewIsHTML; + $this->iMax = $iNewMaxLength; + $this->sInetLookupType = $bHasNewInetLookup; + $this->sInetLookupType = $sNewInetLookupType; + } + + function getID() { return $this->iId; } + function getName() { return $this->sName; } + function setName($sNewValue) { $this->sName = $sNewValue; } + function setDescription($sNewValue) { $this->sDescription = $sNewValue; } + function getDescription() { return $this->sDescription; } + function getDataType() { return $this->sDataType; } function setDataType($sNewValue) { $this->sDataType = $sNewValue; } - function getIsGeneric() { return $this->bIsGeneric; } - function setIsGeneric($sNewValue) { $this->bIsGeneric = $sNewValue; } + function getIsGeneric() { return $this->bIsGeneric; } + function setIsGeneric($sNewValue) { $this->bIsGeneric = $sNewValue; } function getHasLookup() { return $this->bHasLookup; } - function setHasLookup($iNewValue) { $this->bHasLookup = $iNewValue; } + function setHasLookup($iNewValue) { $this->bHasLookup = $iNewValue; } function getParentFieldset() { return $this->iParentFieldset; } - function setParentFieldset($iNewValue) { $this->iParentFieldset = $iNewValue; } + function setParentFieldset($iNewValue) { $this->iParentFieldset = $iNewValue; } function getParentFieldsetId() { return $this->iParentFieldset; } - function setParentFieldsetId($iNewValue) { $this->iParentFieldset = $iNewValue; } + function setParentFieldsetId($iNewValue) { $this->iParentFieldset = $iNewValue; } function getHasLookupTree() { return $this->bHasLookupTree; } - function setHasLookupTree($iNewValue) { $this->bHasLookupTree = KTUtil::anyToBool($iNewValue); } + function setHasLookupTree($iNewValue) { $this->bHasLookupTree = KTUtil::anyToBool($iNewValue); } function getIsMandatory() { return $this->bIsMandatory; } - function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); } + function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); } function getPosition() { return $this->iPosition; } - function setPosition($iNewValue) { $this->iPosition = $iNewValue; } + function setPosition($iNewValue) { $this->iPosition = $iNewValue; } function getIsHTML() { return $this->bIsHTML; } - function setIsHTML($iNewValue) { $this->bIsHTML = $iNewValue; } - function getMaxLength() { return $this->iMax; } - function setMaxLength($iNewValue) { $this->iMax = $iNewValue; } - function getHasInetLookup() { return $this->bHasInetLookup; } - function setHasInetLookup($iNewValue) { $this->bHasInetLookup = $iNewValue; } - function getInetLookupType() { return $this->sInetLookupType; } - function setInetLookupType($sNewValue) { $this->sInetLookupType = $sNewValue; } - function getInetLookupTypeFriendlyName() - { - $aDescriptors = array(); - if($this->getInetLookupType() == "multiwithlist") - { - $aDescriptors[] = _kt("Multiselect with a list"); - } - elseif($this->getInetLookupType() == "multiwithcheckboxes") - { - $aDescriptors[] = _kt("Multiselect with checkboxes"); - } - + function setIsHTML($iNewValue) { $this->bIsHTML = $iNewValue; } + function getMaxLength() { return $this->iMax; } + function setMaxLength($iNewValue) { $this->iMax = $iNewValue; } + function getHasInetLookup() { return $this->bHasInetLookup; } + function setHasInetLookup($iNewValue) { $this->bHasInetLookup = $iNewValue; } + function getInetLookupType() { return $this->sInetLookupType; } + function setInetLookupType($sNewValue) { $this->sInetLookupType = $sNewValue; } + function getInetLookupTypeFriendlyName() + { + $aDescriptors = array(); + if($this->getInetLookupType() == "multiwithlist") + { + $aDescriptors[] = _kt("Multiselect with a list"); + } + elseif($this->getInetLookupType() == "multiwithcheckboxes") + { + $aDescriptors[] = _kt("Multiselect with checkboxes"); + } + // required if ($this->getIsMandatory()) { $aDescriptors[] = _kt("Required"); @@ -158,13 +158,13 @@ class DocumentField extends KTEntity { } return implode(', ', $aDescriptors); - } + } function _fieldValues () { return array( 'name' => $this->sName, - 'description' => $this->sDescription, + 'description' => $this->sDescription, 'data_type' => $this->sDataType, 'is_generic' => KTUtil::anyToBool($this->bIsGeneric), 'has_lookup' => KTUtil::anyToBool($this->bHasLookup), @@ -185,7 +185,7 @@ class DocumentField extends KTEntity { } function &getList($sWhereClause = null) { - return KTEntityUtil::getList2('DocumentField', $sWhereClause); + return KTEntityUtil::getList2('DocumentField', $sWhereClause); } function &createFromArray($aOptions) { @@ -226,27 +226,27 @@ class DocumentField extends KTEntity { return KTEntityUtil::get('DocumentField', $iId); } - // FIXME: add a data type class! - /* Static function. Given a documenttype...will find all fields belongin to it - * - * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"] - */ - function getLookupCount($iDocumentFieldID){ - $sTable = 'metadata'; - $sQuery = "SELECT COUNT(*) AS count FROM " . $sTable . " WHERE document_field_id = ?"; - $aParams = array($iDocumentFieldID); + // FIXME: add a data type class! + /* Static function. Given a documenttype...will find all fields belongin to it + * + * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"] + */ + function getLookupCount($iDocumentFieldID){ + $sTable = 'metadata'; + $sQuery = "SELECT COUNT(*) AS count FROM " . $sTable . " WHERE document_field_id = ?"; + $aParams = array($iDocumentFieldID); $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'count'); if (PEAR::isError($res)) { return false; // return $res; } return $res; - } + } function getType() { - if($this->bHasInetLookup){ + if($this->bHasInetLookup){ return _kt('Multiselect'); - } + } if (empty($this->bHasLookup)) { return _kt("Normal"); } @@ -312,148 +312,148 @@ class DocumentField extends KTEntity { function reorderFields($iFieldsetId) { // Get the fields in the order they'll appear - first by position then by id $sql = "SELECT id, position FROM document_fields - WHERE parent_fieldset = ? - ORDER BY position, id ASC"; - $aParams = array($iFieldsetId); + WHERE parent_fieldset = ? + ORDER BY position, id ASC"; + $aParams = array($iFieldsetId); + + $result = DBUtil::getResultArray(array($sql, $aParams)); + + if(PEAR::isError($result) || empty($result)){ + return false; + } + + // Set all positions to be unique and in order + foreach($result as $key => $field){ + $position = $field['position']; - $result = DBUtil::getResultArray(array($sql, $aParams)); + // If the fields position is correct in the order, continue + if($position == $key){ + continue; + } - if(PEAR::isError($result) || empty($result)){ - return false; - } + // Reset the position + $aFields = array(); + $aFields['position'] = $key; - // Set all positions to be unique and in order - foreach($result as $key => $field){ - $position = $field['position']; + $res = DBUtil::autoUpdate('document_fields', $aFields, $field['id']); + } + return true; + } - // If the fields position is correct in the order, continue - if($position == $key){ - continue; - } + /** + * Get the postion of the last field + */ + function getNextFieldPosition($iFieldsetId){ + $sql = "SELECT position FROM document_fields + WHERE parent_fieldset = ? + ORDER BY position DESC LIMIT 1"; + $aParams = array($iFieldsetId); - // Reset the position - $aFields = array(); - $aFields['position'] = $key; + $result = DBUtil::getResultArray(array($sql, $aParams)); - $res = DBUtil::autoUpdate('document_fields', $aFields, $field['id']); - } - return true; + if(PEAR::isError($result) || empty($result)){ + return 0; + } + return $result[0]['position'] + 1; } - /** - * Get the postion of the last field - */ - function getNextFieldPosition($iFieldsetId){ - $sql = "SELECT position FROM document_fields - WHERE parent_fieldset = ? - ORDER BY position DESC LIMIT 1"; - $aParams = array($iFieldsetId); - - $result = DBUtil::getResultArray(array($sql, $aParams)); - - if(PEAR::isError($result) || empty($result)){ - return 0; - } - return $result[0]['position'] + 1; - } - - /** - * Get the next postion up / down - */ - function getNextPosition($iFieldsetId, $iId, $position, $dir = 'up') { - switch($dir){ - case 'down': - $comp = '>'; - $order = 'ASC'; - break; - default: - $comp = '<'; - $order = 'DESC'; - } - - // Get the column above / below to swop position - $sql = "SELECT id, position FROM document_fields - WHERE parent_fieldset = ? AND (position {$comp} ? || (position = ? AND id {$comp} ?)) - ORDER BY position {$order} LIMIT 1"; - $aParams = array($iFieldsetId, $position, $position, $iId); - - $result = DBUtil::getOneResult(array($sql, $aParams)); - - if(PEAR::isError($result) || empty($result)){ - return false; - } - return $result; - } - - /** - * Get the updated position of the field - * - * @param int $iId - * @return int - */ - function getNewPosition($iId){ - // Get the new position - $sql = "SELECT id, position FROM document_fields - WHERE id = ?"; - $aParams = array($iId); - $result = DBUtil::getOneResult(array($sql, $aParams)); - - if(PEAR::isError($result) || empty($result)){ - return false; - } - return $result['position']; - } - - /** - * Update the position of a field - */ - function updatePosition($iId, $position) { - $aFields = array('position' => $position); - DBUtil::autoUpdate('document_fields', $aFields, $iId); - } - - /** - * Move the display position of the field up - */ - function movePosition($iFieldsetId, $iId, $dir = 'up') { - $position = $this->getPosition(); - - // Get the field to swop position with - $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir); - if($next === false){ - return false; - } - - // Get position of the next field up / down - $newPos = $next['position']; - $iNextId = $next['id']; - - if($newPos == $position){ - // 2 fields have the same position - reorder them - $res = $this->reorderFields($iFieldsetId); - if($res === false){ - return false; - } - - $position = $this->getNewPosition($iId); - if($position === false){ - return false; - } - - // Get the field to swop with - $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir); - if($next === false){ - return false; - } - $newPos = $next['position']; - $iNextId = $next['id']; - } - - // update the fields - $this->updatePosition($iId, $newPos); - $this->updatePosition($iNextId, $position); - return true; - } + /** + * Get the next postion up / down + */ + function getNextPosition($iFieldsetId, $iId, $position, $dir = 'up') { + switch($dir){ + case 'down': + $comp = '>'; + $order = 'ASC'; + break; + default: + $comp = '<'; + $order = 'DESC'; + } + + // Get the column above / below to swop position + $sql = "SELECT id, position FROM document_fields + WHERE parent_fieldset = ? AND (position {$comp} ? || (position = ? AND id {$comp} ?)) + ORDER BY position {$order} LIMIT 1"; + $aParams = array($iFieldsetId, $position, $position, $iId); + + $result = DBUtil::getOneResult(array($sql, $aParams)); + + if(PEAR::isError($result) || empty($result)){ + return false; + } + return $result; + } + + /** + * Get the updated position of the field + * + * @param int $iId + * @return int + */ + function getNewPosition($iId){ + // Get the new position + $sql = "SELECT id, position FROM document_fields + WHERE id = ?"; + $aParams = array($iId); + $result = DBUtil::getOneResult(array($sql, $aParams)); + + if(PEAR::isError($result) || empty($result)){ + return false; + } + return $result['position']; + } + + /** + * Update the position of a field + */ + function updatePosition($iId, $position) { + $aFields = array('position' => $position); + DBUtil::autoUpdate('document_fields', $aFields, $iId); + } + + /** + * Move the display position of the field up + */ + function movePosition($iFieldsetId, $iId, $dir = 'up') { + $position = $this->getPosition(); + + // Get the field to swop position with + $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir); + if($next === false){ + return false; + } + + // Get position of the next field up / down + $newPos = $next['position']; + $iNextId = $next['id']; + + if($newPos == $position){ + // 2 fields have the same position - reorder them + $res = $this->reorderFields($iFieldsetId); + if($res === false){ + return false; + } + + $position = $this->getNewPosition($iId); + if($position === false){ + return false; + } + + // Get the field to swop with + $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir); + if($next === false){ + return false; + } + $newPos = $next['position']; + $iNextId = $next['id']; + } + + // update the fields + $this->updatePosition($iId, $newPos); + $this->updatePosition($iNextId, $position); + return true; + } } /** @@ -461,13 +461,13 @@ class DocumentField extends KTEntity { * * Creates a document type object from an array * -* @param Array Array of parameters. Must match order of parameters in constructor +* @param Array Array of parameters. Must match order of parameters in constructor * * @return User user object */ function & documentfieldCreateFromArray($aParameters) { - $oDocField = new DocumentField($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); - return $oDocField; + $oDocField = new DocumentField($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); + return $oDocField; } diff --git a/lib/metadata/fieldsetregistry.inc.php b/lib/metadata/fieldsetregistry.inc.php index 803fea7..239bd07 100755 --- a/lib/metadata/fieldsetregistry.inc.php +++ b/lib/metadata/fieldsetregistry.inc.php @@ -102,19 +102,19 @@ class KTFieldsetRegistry { $widgets = array(); $fields = $oFieldset->getFields(); - if ($oFieldset->getIsConditional()) { - $iMasterId = $oFieldset->getMasterFieldId(); - - $oMasterField = DocumentField::get($iMasterId); - - $newfields = array(); - $newfields[] = $oMasterField; - foreach($fields as $oField) { - if($oField->getId() != $iMasterId) { - $newfields[] = $oField; - } - } - + if ($oFieldset->getIsConditional()) { + $iMasterId = $oFieldset->getMasterFieldId(); + + $oMasterField = DocumentField::get($iMasterId); + + $newfields = array(); + $newfields[] = $oMasterField; + foreach($fields as $oField) { + if($oField->getId() != $iMasterId) { + $newfields[] = $oField; + } + } + foreach ($newfields as $oField) { $fname = 'metadata_' . $oField->getId(); $value = null; @@ -126,23 +126,23 @@ class KTFieldsetRegistry { } } - $widgets[] = $this->oWF->get('ktcore.widgets.conditionalselection', - array( - 'label' => $oField->getName(), - 'required' => $oField->getIsMandatory(), - 'name' => $fname, - 'value' => $value, - 'description' => $oField->getDescription(), - 'vocab' => MetaData::getEnabledByDocumentField($oField), - 'id_method' => 'getName', - 'label_method' => 'getName', - 'unselected_label' => _kt("No selection."), - 'simple_select' => false, - 'master' => ($oField->getId() == $iMasterId), - 'masterid' => $iMasterId, - 'fieldset' => $oFieldset->getId(), - 'field' => $oField->getId(), - )); + $widgets[] = $this->oWF->get('ktcore.widgets.conditionalselection', + array( + 'label' => $oField->getName(), + 'required' => $oField->getIsMandatory(), + 'name' => $fname, + 'value' => $value, + 'description' => $oField->getDescription(), + 'vocab' => MetaData::getEnabledByDocumentField($oField), + 'id_method' => 'getName', + 'label_method' => 'getName', + 'unselected_label' => _kt("No selection."), + 'simple_select' => false, + 'master' => ($oField->getId() == $iMasterId), + 'masterid' => $iMasterId, + 'fieldset' => $oFieldset->getId(), + 'field' => $oField->getId(), + )); } } else { foreach ($fields as $oField) { @@ -170,13 +170,13 @@ class KTFieldsetRegistry { $type = 'ktcore.fields.lookup'; } } else if($oField->getHasInetLookup()) { - $type = 'ktcore.fields.multiselect'; - } else { + $type = 'ktcore.fields.multiselect'; + } else { $type = 'ktcore.fields.string'; } if ($oField->getDataType() == 'LARGE TEXT') { - $type = 'ktcore.fields.largetext'; + $type = 'ktcore.fields.largetext'; } else if ($oField->getDataType() == 'DATE') { $type = 'ktcore.fields.date'; } @@ -212,7 +212,7 @@ class KTFieldsetRegistry { 'vocab' => MetaData::getEnabledByDocumentField($oField), 'field_id' => $oField->getId(), )); - } else if ($type == 'ktcore.fields.largetext') { + } else if ($type == 'ktcore.fields.largetext') { $widgets[] = $this->oWF->get('ktcore.widgets.textarea', array( 'label' => $oField->getName(), 'required' => $oField->getIsMandatory(), @@ -221,7 +221,7 @@ class KTFieldsetRegistry { 'description' => $oField->getDescription(), 'field' => $oField, )); - } else if ($type == 'ktcore.fields.date') { + } else if ($type == 'ktcore.fields.date') { $widgets[] = $this->oWF->get('ktcore.widgets.date', array( 'label' => $oField->getName(), 'required' => $oField->getIsMandatory(), @@ -230,50 +230,50 @@ class KTFieldsetRegistry { 'description' => $oField->getDescription(), )); } else if ($type == 'ktcore.fields.multiselect') { - if($oField->getInetLookupType() == "multiwithlist") { - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( - 'label' => $oField->getName(), - 'required' => $oField->getIsMandatory(), - 'name' => $fname, - 'value' => explode(", ",$value), - 'description' => $oField->getDescription(), - 'vocab' => MetaData::getEnabledByDocumentField($oField), - 'id_method' => 'getName', - 'label_method' => 'getName', - 'unselected_label' => false, - 'simple_select' => false, - 'multi'=> true, - )); - } else if($oField->getInetLookupType() == "multiwithcheckboxes") { - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( - 'label' => $oField->getName(), - 'required' => $oField->getIsMandatory(), - 'name' => $fname, - 'value' => explode(", ",$value), - 'description' => $oField->getDescription(), - 'vocab' => MetaData::getEnabledByDocumentField($oField), + if($oField->getInetLookupType() == "multiwithlist") { + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( + 'label' => $oField->getName(), + 'required' => $oField->getIsMandatory(), + 'name' => $fname, + 'value' => explode(", ",$value), + 'description' => $oField->getDescription(), + 'vocab' => MetaData::getEnabledByDocumentField($oField), + 'id_method' => 'getName', + 'label_method' => 'getName', + 'unselected_label' => false, + 'simple_select' => false, + 'multi'=> true, + )); + } else if($oField->getInetLookupType() == "multiwithcheckboxes") { + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( + 'label' => $oField->getName(), + 'required' => $oField->getIsMandatory(), + 'name' => $fname, + 'value' => explode(", ",$value), + 'description' => $oField->getDescription(), + 'vocab' => MetaData::getEnabledByDocumentField($oField), 'field_id' => $oField->getId(), - 'id_method' => 'getName', - 'label_method' => 'getName', - 'unselected_label' => false, - 'simple_select' => true, - 'multi'=> true, - )); - } else { - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( - 'label' => $oField->getName(), - 'required' => $oField->getIsMandatory(), - 'name' => $fname, - 'value' => $value, - 'description' => $oField->getDescription(), + 'id_method' => 'getName', + 'label_method' => 'getName', + 'unselected_label' => false, + 'simple_select' => true, + 'multi'=> true, + )); + } else { + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array( + 'label' => $oField->getName(), + 'required' => $oField->getIsMandatory(), + 'name' => $fname, + 'value' => $value, + 'description' => $oField->getDescription(), 'field' => $oField, - 'vocab' => MetaData::getEnabledByDocumentField($oField), - 'id_method' => 'getName', - 'label_method' => 'getName', - 'unselected_label' => _kt("No selection."), - 'simple_select' => false, - )); - } + 'vocab' => MetaData::getEnabledByDocumentField($oField), + 'id_method' => 'getName', + 'label_method' => 'getName', + 'unselected_label' => _kt("No selection."), + 'simple_select' => false, + )); + } } else if ($type == 'ktcore.fields.tree') { $widgets[] = $this->oWF->get('ktcore.widgets.treemetadata', array( @@ -290,15 +290,15 @@ class KTFieldsetRegistry { } - - return array($this->oWF->get('ktcore.widgets.fieldset', - array( + + return array($this->oWF->get('ktcore.widgets.fieldset', + array( 'label' => $oFieldset->getName(), 'description' => $oFieldset->getDescription(), 'name' => $sContainerName, 'widgets' => $widgets, ))); - + } @@ -322,15 +322,15 @@ class KTFieldsetRegistry { foreach ($fields as $oField) { $fname = 'metadata_' . $oField->getId(); - // Change back to 'membership' - $validators[] = $this->oVF->get('ktcore.validators.membership', - array( - 'test' => $fname, - 'output' => $fname, - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), - 'id_method' => 'getName', - )); - } + // Change back to 'membership' + $validators[] = $this->oVF->get('ktcore.validators.membership', + array( + 'test' => $fname, + 'output' => $fname, + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), + 'id_method' => 'getName', + )); + } } else { $validators = array(); $fields = $oFieldset->getFields(); @@ -359,8 +359,8 @@ class KTFieldsetRegistry { $type = 'ktcore.fields.lookup'; } } else if($oField->getHasInetLookup()) { - $type = 'ktcore.fields.multiselect'; - } else { + $type = 'ktcore.fields.multiselect'; + } else { $type = 'ktcore.fields.string'; } @@ -387,35 +387,35 @@ class KTFieldsetRegistry { 'id_method' => 'getName', )); } else if ($type == 'ktcore.fields.multiselect') { - if($oField->getInetLookupType() == "multiwithlist") - { - $validators[] = $this->oVF->get('ktcore.validators.membership',array( - 'test' => $fname, - 'output' => $fname, - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), - 'id_method' => 'getName', - 'multi' => true, - )); - } - else if($oField->getInetLookupType() == "multiwithcheckboxes") - { - $validators[] = $this->oVF->get('ktcore.validators.membership',array( - 'test' => $fname, - 'output' => $fname, - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), - 'id_method' => 'getName', - 'multi' => true, - )); - } - else - { - $validators[] = $this->oVF->get('ktcore.validators.membership',array( - 'test' => $fname, - 'output' => $fname, - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), - 'id_method' => 'getName', - )); - } + if($oField->getInetLookupType() == "multiwithlist") + { + $validators[] = $this->oVF->get('ktcore.validators.membership',array( + 'test' => $fname, + 'output' => $fname, + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), + 'id_method' => 'getName', + 'multi' => true, + )); + } + else if($oField->getInetLookupType() == "multiwithcheckboxes") + { + $validators[] = $this->oVF->get('ktcore.validators.membership',array( + 'test' => $fname, + 'output' => $fname, + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), + 'id_method' => 'getName', + 'multi' => true, + )); + } + else + { + $validators[] = $this->oVF->get('ktcore.validators.membership',array( + 'test' => $fname, + 'output' => $fname, + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField), + 'id_method' => 'getName', + )); + } } else { $validators[] = PEAR::raiseError(sprintf(_kt("Unable to deal with field: id %d"), $oField->getId())); @@ -423,8 +423,8 @@ class KTFieldsetRegistry { } } - return array($this->oVF->get('ktcore.validators.fieldset', - array( + return array($this->oVF->get('ktcore.validators.fieldset', + array( 'test' => $sContainerName, 'output' => $sContainerName, 'validators' => $validators, diff --git a/lib/search/searchutil.inc.php b/lib/search/searchutil.inc.php index 0c1d976..6317e13 100644 --- a/lib/search/searchutil.inc.php +++ b/lib/search/searchutil.inc.php @@ -63,7 +63,7 @@ class KTSearchUtil { $type = KTUtil::arrayGet($dataset, "type"); $sql = KTUtil::arrayGet($dataset, "sql"); if (!empty($type)) { - $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']); if (PEAR::isError($oCriterion)) { return PEAR::raiseError(_kt('Invalid criteria specified.')); @@ -84,46 +84,46 @@ class KTSearchUtil { $aReq = $oCriterionPair[1]; if (is_object($oCriterion)) { - if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) - { - //$newAReq = $aReq; - $aNewSQL = array(); - foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval) - { - $newAReq = $aReq; - $newAReq[$oCriterion->sNamespace] = $vval; - $res = $oCriterion->searchSQL($newAReq); - if (!is_null($res)) { - $aNewSQL[] = $res; - } - } - - $aNewSQL0 = array(); - $aNewSQL1 = array(); - foreach($aNewSQL as $ind=>$sQ) - { - $aNewSQL0[] = $sQ[0]; - $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]); - } - - $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 ); - - $res = $oCriterion->searchJoinSQL(); - if (!is_null($res)) { - $aJoinSQL[] = $res; - } - } - else - { - $res = $oCriterion->searchSQL($aReq); - if (!is_null($res)) { - $aSQL[] = $res; - } - $res = $oCriterion->searchJoinSQL(); - if (!is_null($res)) { - $aJoinSQL[] = $res; - } - } + if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) + { + //$newAReq = $aReq; + $aNewSQL = array(); + foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval) + { + $newAReq = $aReq; + $newAReq[$oCriterion->sNamespace] = $vval; + $res = $oCriterion->searchSQL($newAReq); + if (!is_null($res)) { + $aNewSQL[] = $res; + } + } + + $aNewSQL0 = array(); + $aNewSQL1 = array(); + foreach($aNewSQL as $ind=>$sQ) + { + $aNewSQL0[] = $sQ[0]; + $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]); + } + + $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 ); + + $res = $oCriterion->searchJoinSQL(); + if (!is_null($res)) { + $aJoinSQL[] = $res; + } + } + else + { + $res = $oCriterion->searchSQL($aReq); + if (!is_null($res)) { + $aSQL[] = $res; + } + $res = $oCriterion->searchJoinSQL(); + if (!is_null($res)) { + $aJoinSQL[] = $res; + } + } } else { $aSQL[] = array($oCriterion, $aReq); } @@ -152,137 +152,137 @@ class KTSearchUtil { } // }}} - /** - * All for folders only + /** + * All for folders only * Handles leaf criteria set (ie, no subgroups), generating SQL for * the values in the criteria. * * (This would be the place to extend criteria to support contains, * starts with, ends with, greater than, and so forth.) */ - function _oneCriteriaFolderSetToSQL($aOneCriteriaSet) { - $aSQL = array(); - $aJoinSQL = array(); - $criteria_set = array(); - - /* - * First phase: get criterion object for search or the direct - * SQL to use. - * - * XXX: Why is there $order there? - */ - foreach ($aOneCriteriaSet as $order => $dataset) { - $type = KTUtil::arrayGet($dataset, "type"); - $sql = KTUtil::arrayGet($dataset, "sql"); - if (!empty($type)) { - $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); - $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']); - - if (PEAR::isError($oCriterion)) { - return PEAR::raiseError(_kt('Invalid criteria specified.')); - } - $criteria_set[] = array($oCriterion, $dataset["data"]); - } else if (!empty($sql)) { - $criteria_set[] = $sql; - } else { - return PEAR::raiseError(_kt('Invalid criteria specified.')); - } - } - - /* - * Second phase: Create an individual SQL query per criteria. - */ - foreach ($criteria_set as $oCriterionPair) { - $oCriterion->aLookup[table]='folder_field_links'; - - $oCriterion = $oCriterionPair[0]; - $aReq = $oCriterionPair[1]; - - - - - if (is_object($oCriterion)) { - // changed by dp start // for multiselect search for folders - if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) - { - $aNewSQL = array(); - foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval) - { - $newAReq = $aReq; - $newAReq[$oCriterion->sNamespace] = $vval; - $res = $oCriterion->searchSQL($newAReq); - if (!is_null($res)) { - $aNewSQL[] = $res; - } - } - - $aNewSQL0 = array(); - $aNewSQL1 = array(); - foreach($aNewSQL as $ind=>$sQ) - { - $aNewSQL0[] = $sQ[0]; - $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]); - } - $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 ); - $res = $oCriterion->searchJoinSQL(); - if (!is_null($res)) { - if(strstr($res,'D.metadata_version_id')){ - $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res); - } - if(strstr($res,'document_fields_link')){ - $res=str_replace('document_fields_link','folder_fields_link',$res); - } - $aJoinSQL[] = $res; - } - }// changed by dp end // for multiselect search for folders - else - { - $res = $oCriterion->searchSQL($aReq); - if (!is_null($res)) { - $aSQL[] = $res; - } - $res = $oCriterion->searchJoinSQL(); - if (!is_null($res)) { - - if(strstr($res,'D.metadata_version_id')){ - $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res); - } - if(strstr($res,'document_fields_link')){ - $res=str_replace('document_fields_link','folder_fields_link',$res); - } - $aJoinSQL[] = $res; - } - } - - } else { - $aSQL[] = array($oCriterion, $aReq); - } - } - - /* - * Third phase: build up $aCritQueries and $aCritParams, and put - * parentheses around them. - */ - $aCritParams = array(); - $aCritQueries = array(); - foreach ($aSQL as $sSQL) { - if (is_array($sSQL)) { - $aCritQueries[] = '('.$sSQL[0].')'; - $aCritParams = kt_array_merge($aCritParams , $sSQL[1]); - } else { - $aCritQueries[] = '('.$sSQL.')'; - } - } - - - if (count($aCritQueries) == 0) { - return PEAR::raiseError(_kt("No search criteria were specified")); - } - - return array($aCritQueries, $aCritParams, $aJoinSQL); - } - /** - * All for folders + function _oneCriteriaFolderSetToSQL($aOneCriteriaSet) { + $aSQL = array(); + $aJoinSQL = array(); + $criteria_set = array(); + + /* + * First phase: get criterion object for search or the direct + * SQL to use. + * + * XXX: Why is there $order there? + */ + foreach ($aOneCriteriaSet as $order => $dataset) { + $type = KTUtil::arrayGet($dataset, "type"); + $sql = KTUtil::arrayGet($dataset, "sql"); + if (!empty($type)) { + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); + $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']); + + if (PEAR::isError($oCriterion)) { + return PEAR::raiseError(_kt('Invalid criteria specified.')); + } + $criteria_set[] = array($oCriterion, $dataset["data"]); + } else if (!empty($sql)) { + $criteria_set[] = $sql; + } else { + return PEAR::raiseError(_kt('Invalid criteria specified.')); + } + } + + /* + * Second phase: Create an individual SQL query per criteria. + */ + foreach ($criteria_set as $oCriterionPair) { + $oCriterion->aLookup[table]='folder_field_links'; + + $oCriterion = $oCriterionPair[0]; + $aReq = $oCriterionPair[1]; + + + + + if (is_object($oCriterion)) { + // changed by dp start // for multiselect search for folders + if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin')) + { + $aNewSQL = array(); + foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval) + { + $newAReq = $aReq; + $newAReq[$oCriterion->sNamespace] = $vval; + $res = $oCriterion->searchSQL($newAReq); + if (!is_null($res)) { + $aNewSQL[] = $res; + } + } + + $aNewSQL0 = array(); + $aNewSQL1 = array(); + foreach($aNewSQL as $ind=>$sQ) + { + $aNewSQL0[] = $sQ[0]; + $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]); + } + $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 ); + $res = $oCriterion->searchJoinSQL(); + if (!is_null($res)) { + if(strstr($res,'D.metadata_version_id')){ + $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res); + } + if(strstr($res,'document_fields_link')){ + $res=str_replace('document_fields_link','folder_fields_link',$res); + } + $aJoinSQL[] = $res; + } + }// changed by dp end // for multiselect search for folders + else + { + $res = $oCriterion->searchSQL($aReq); + if (!is_null($res)) { + $aSQL[] = $res; + } + $res = $oCriterion->searchJoinSQL(); + if (!is_null($res)) { + + if(strstr($res,'D.metadata_version_id')){ + $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res); + } + if(strstr($res,'document_fields_link')){ + $res=str_replace('document_fields_link','folder_fields_link',$res); + } + $aJoinSQL[] = $res; + } + } + + } else { + $aSQL[] = array($oCriterion, $aReq); + } + } + + /* + * Third phase: build up $aCritQueries and $aCritParams, and put + * parentheses around them. + */ + $aCritParams = array(); + $aCritQueries = array(); + foreach ($aSQL as $sSQL) { + if (is_array($sSQL)) { + $aCritQueries[] = '('.$sSQL[0].')'; + $aCritParams = kt_array_merge($aCritParams , $sSQL[1]); + } else { + $aCritQueries[] = '('.$sSQL.')'; + } + } + + + if (count($aCritQueries) == 0) { + return PEAR::raiseError(_kt("No search criteria were specified")); + } + + return array($aCritQueries, $aCritParams, $aJoinSQL); + } + /** + * All for folders * Converts a criteria set to the SQL joins, where clause, and * parameters necessary to ensure that the criteria listed restrict * the folders returned to those that match the criteria. @@ -295,7 +295,7 @@ class KTSearchUtil { * - Array of parameters that go with the where clause * - String with the SQL necessary to join with the tables in the * where clause - */ + */ function criteriaFolderSetToSQL($aCriteriaSet, $iRecurseLevel = 0) { $aJoinSQL = array(); $aSearchStrings = array(); @@ -315,18 +315,18 @@ class KTSearchUtil { $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup"); if (!empty($aValues)) { - $res = KTSearchUtil::_oneCriteriaFolderSetToSQL($aOneCriteriaSet["values"]); - - if(PEAR::isError($res)) { - return $res; - } - list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res; - $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL); - $aParams = kt_array_merge($aParams, $aThisParams); - $tabs = str_repeat("\t", ($iRecurseLevel + 2)); - $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; + $res = KTSearchUtil::_oneCriteriaFolderSetToSQL($aOneCriteriaSet["values"]); + + if(PEAR::isError($res)) { + return $res; + } + list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res; + $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL); + $aParams = kt_array_merge($aParams, $aThisParams); + $tabs = str_repeat("\t", ($iRecurseLevel + 2)); + $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; } else if (!empty($aSubgroup)) { - + /* * Recurse if we have a criteria set with subgroups. * Recurselevel makes the tabs increase as we recurse so @@ -346,9 +346,9 @@ class KTSearchUtil { return array($sSearchString, $aParams, $sJoinSQL); } - - /** - * All for folders + + /** + * All for folders * Converts a criteria set into a SQL query that (by default) * returns the ids of documents that fulfil the criteria. * @@ -362,7 +362,7 @@ class KTSearchUtil { * - String containing the parameterised SQL query * - Array containing the parameters for the SQL query */ - function criteriaToFolderQuery($aCriteriaSet, $oUser, $sPermissionName, $aOptions = null) { + function criteriaToFolderQuery($aCriteriaSet, $oUser, $sPermissionName, $aOptions = null) { global $default; $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id AS folder_id'); $sInitialJoin = KTUtil::arrayGet($aOptions, 'join', ''); @@ -371,15 +371,15 @@ class KTSearchUtil { $sInitialJoin = $sInitialJoin[0]; } - $res = KTSearchUtil::criteriaFolderSetToSQL($aCriteriaSet); + $res = KTSearchUtil::criteriaFolderSetToSQL($aCriteriaSet); - if(PEAR::isError($res)) return $res; + if(PEAR::isError($res)) return $res; list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res; $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version. $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName); - + if (PEAR::isError($res)) { // only occurs if the group has no permissions. return $res; } else { @@ -433,17 +433,17 @@ class KTSearchUtil { $aParams = kt_array_merge($aParams, $aInitialJoinParams); $aParams = kt_array_merge($aParams, $aPermissionParams); - if($sToSearch!='Live') + if($sToSearch!='Live') $aParams[] = $sToSearch; $aParams = kt_array_merge($aParams, $aCritParams); - - - if(strstr($sQuery,'document_field_id')){ - $sQuery=str_replace('document_field_id','folder_field_id',$sQuery); - } - if(strstr($sQuery,'D.creator_id')){ - $sQuery=str_replace('D.creator_id','F.creator_id',$sQuery); - } + + + if(strstr($sQuery,'document_field_id')){ + $sQuery=str_replace('document_field_id','folder_field_id',$sQuery); + } + if(strstr($sQuery,'D.creator_id')){ + $sQuery=str_replace('D.creator_id','F.creator_id',$sQuery); + } return array($sQuery, $aParams); } // {{{ criteriaSetToSQL @@ -479,15 +479,15 @@ class KTSearchUtil { $aValues = KTUtil::arrayGet($aOneCriteriaSet, "values"); $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup"); if (!empty($aValues)) { - $res = KTSearchUtil::_oneCriteriaSetToSQL($aOneCriteriaSet["values"]); - if(PEAR::isError($res)) { - return $res; - } - list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res; - $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL); - $aParams = kt_array_merge($aParams, $aThisParams); - $tabs = str_repeat("\t", ($iRecurseLevel + 2)); - $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; + $res = KTSearchUtil::_oneCriteriaSetToSQL($aOneCriteriaSet["values"]); + if(PEAR::isError($res)) { + return $res; + } + list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res; + $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL); + $aParams = kt_array_merge($aParams, $aThisParams); + $tabs = str_repeat("\t", ($iRecurseLevel + 2)); + $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; } else if (!empty($aSubgroup)) { /* * Recurse if we have a criteria set with subgroups. @@ -595,15 +595,15 @@ class KTSearchUtil { $sInitialJoin = $sInitialJoin[0]; } - $res = KTSearchUtil::criteriaSetToSQL($aCriteriaSet); + $res = KTSearchUtil::criteriaSetToSQL($aCriteriaSet); - if(PEAR::isError($res)) return $res; + if(PEAR::isError($res)) return $res; list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res; $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version. $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName); - + if (PEAR::isError($res)) { // only occurs if the group has no permissions. return $res; } else { @@ -715,8 +715,8 @@ class KTSearchUtil { return $cnt > 0; } // }}} - - + + function testConditionOnFolder($oSearch, $oFolder) { $oSearch =& KTUtil::getObject('KTSavedSearch', $oSearch); $iFolderId = KTUtil::getId($oFolder); @@ -741,7 +741,7 @@ function testConditionOnFolder($oSearch, $oFolder) { ), ); $aOptions = array('select' => 'COUNT(DISTINCT(F.id)) AS cnt'); - $aQuery = KTSearchUtil::criteriaToFolderQuery($aCriteriaSet, null, null, $aOptions); + $aQuery = KTSearchUtil::criteriaToFolderQuery($aCriteriaSet, null, null, $aOptions); @@ -759,8 +759,8 @@ function testConditionOnFolder($oSearch, $oFolder) { if (!is_numeric($cnt)) { return PEAR::raiseError(_kt("Non-integer returned when looking for count")); } - + return $cnt > 0; } - + } \ No newline at end of file diff --git a/lib/widgets/fieldsetDisplay.inc.php b/lib/widgets/fieldsetDisplay.inc.php index 6c9b400..c6b6821 100644 --- a/lib/widgets/fieldsetDisplay.inc.php +++ b/lib/widgets/fieldsetDisplay.inc.php @@ -108,13 +108,13 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null $fieldTree = new MDTree(); $fieldTree->buildForField($field->getId()); $fieldTree->setActiveItem($current_value); - $fieldOptions['tree'] = $fieldTree->_evilTreeRenderer($fieldTree, $fieldName); + $fieldOptions['tree'] = $fieldTree->_evilTreeRenderer($fieldTree, $fieldName); $oField = new KTTreeWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); } } else if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && $field->getHasInetLookup()){ - require_once(KT_DIR."/plugins/multiselect/InetWidgets.php"); - if ($vocab === null) { // allow override + require_once(KT_DIR."/plugins/multiselect/InetWidgets.php"); + if ($vocab === null) { // allow override $lookups = MetaData::getEnabledByDocumentField($field); $fieldOptions['vocab'] = array(); // FIXME handle lookups foreach ($lookups as $md) { @@ -123,8 +123,8 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null } else { $fieldOptions['vocab'] = $vocab; } - $fieldOptions['multi'] = true; - $fieldOptions['lookup_type'] = $field->getInetLookupType(); + $fieldOptions['multi'] = true; + $fieldOptions['lookup_type'] = $field->getInetLookupType(); $oField = new InetMultiselectWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); } else { $oField = new KTBaseWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); @@ -184,8 +184,8 @@ class KTFieldsetDisplay { if (!empty($res['friendly_name'])) { return _kt($res['friendly_name']); } else { - return sprintf(_kt('%s File'), strtoupper($res['filetypes'])); - } + return sprintf(_kt('%s File'), strtoupper($res['filetypes'])); + } } @@ -261,7 +261,7 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay { 'document_data' => $aDocumentData, 'document' => $aDocumentData['document'], - 'filename' => $document->getFileName(), + 'filename' => $document->getFileName(), 'creator' => $creator_name, 'owner' => $owner_name, @@ -337,11 +337,11 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay { 'document_data' => $aDocumentData, 'document' => $aDocumentData['document'], - 'title' => $document->getName(), - 'comparison_title' => $comparison_document->getName(), + 'title' => $document->getName(), + 'comparison_title' => $comparison_document->getName(), - 'filename' => $document->getFileName(), - 'comparison_filename' => $comparison_document->getFileName(), + 'filename' => $document->getFileName(), + 'comparison_filename' => $comparison_document->getFileName(), 'creator' => $creator, 'creation_date' => $creation_date, @@ -424,7 +424,7 @@ class SimpleFieldsetDisplay extends KTFieldsetDisplay { 'document' => $aDocumentData['document'], 'fieldset' => $this->fieldset, 'fieldset_values' => $fieldset_values, - 'description' => $this->fieldset->getDescription(), + 'description' => $this->fieldset->getDescription(), ); return $oTemplate->render($aTemplateData); } @@ -533,25 +533,25 @@ class ConditionalFieldsetDisplay extends SimpleFieldsetDisplay { // how? $fieldset_name = $this->fieldset->getName(); - $fieldset_description = _kt($this->fieldset->getDescription()); // need a better approach. how do we handle database-resident translations? + $fieldset_description = _kt($this->fieldset->getDescription()); // need a better approach. how do we handle database-resident translations? $fieldset_description .= _kt('Note that the options which are available depends on previous choices within this fieldset.'); // FIXME handle the editable case _with_ values. if ($have_values) { - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('kt3/fieldsets/conditional_editable_values'); - $aTemplateData = array( - 'context' => $this, - 'fields' => $fields =& $this->fieldset->getFields(), - 'fieldset_id' => $this->fieldset->getId(), - 'title' => $fieldset_name, - 'description' => $fieldset_description, - 'values' => $values, + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('kt3/fieldsets/conditional_editable_values'); + $aTemplateData = array( + 'context' => $this, + 'fields' => $fields =& $this->fieldset->getFields(), + 'fieldset_id' => $this->fieldset->getId(), + 'title' => $fieldset_name, + 'description' => $fieldset_description, + 'values' => $values, 'errors' => $errors, - ); + ); - return $oTemplate->render($aTemplateData); + return $oTemplate->render($aTemplateData); } // else { $oTemplating =& KTTemplating::getSingleton(); diff --git a/plugins/ktcore/document/edit.php b/plugins/ktcore/document/edit.php index 2374561..690d595 100755 --- a/plugins/ktcore/document/edit.php +++ b/plugins/ktcore/document/edit.php @@ -219,17 +219,17 @@ class KTDocumentEditAction extends KTDocumentAction { if($oField->getDataType() == "LARGE TEXT") { - if(strlen(strip_tags($val)) > $oField->getMaxLength()) - { - $oForm->handleError(sprintf(_kt("Value exceeds max allowed length of %d characters for %s. Current value is %d characters."), $oField->getMaxLength(), $oField->getName(), strlen(strip_tags($val)))); - } + if(strlen(strip_tags($val)) > $oField->getMaxLength()) + { + $oForm->handleError(sprintf(_kt("Value exceeds max allowed length of %d characters for %s. Current value is %d characters."), $oField->getMaxLength(), $oField->getName(), strlen(strip_tags($val)))); + } } // FIXME "null" has strange meanings here. if (!is_null($val)) { if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && is_array($val) && $oField->getHasInetLookup()) { - $val = join(", ",$val); - } + $val = join(", ",$val); + } $MDPack[] = array( $oField, $val diff --git a/plugins/multiselect/BulkImport.php b/plugins/multiselect/BulkImport.php index 2895a74..24348c6 100644 --- a/plugins/multiselect/BulkImport.php +++ b/plugins/multiselect/BulkImport.php @@ -64,7 +64,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction { { $js = ""; $js .= ""; - return $js._kt('Import from Server Location(RATP)'); + return $js._kt('Import from Server Location'); } else { diff --git a/plugins/multiselect/BulkUpload.php b/plugins/multiselect/BulkUpload.php index ad0e6c5..e216637 100644 --- a/plugins/multiselect/BulkUpload.php +++ b/plugins/multiselect/BulkUpload.php @@ -63,7 +63,7 @@ class InetBulkUploadFolderAction extends KTFolderAction { { $js = ""; $js .= ""; - return $js._kt('Bulk Upload (RATP)'); + return $js._kt('Bulk Upload'); } else { diff --git a/plugins/multiselect/MultiSelectPlugin.php b/plugins/multiselect/MultiSelectPlugin.php index 0626ee2..b99ba1c 100644 --- a/plugins/multiselect/MultiSelectPlugin.php +++ b/plugins/multiselect/MultiSelectPlugin.php @@ -52,7 +52,7 @@ class MultiSelectPlugin extends KTPlugin { */ function MultiSelectPlugin($sFilename = null) { $res = parent::KTPlugin($sFilename); - $this->sFriendlyName = _kt('Permits multiselect or single select choices.'); + $this->sFriendlyName = _kt('Multi-select Plugin'); return $res; } @@ -62,7 +62,7 @@ class MultiSelectPlugin extends KTPlugin { */ function setup() { $oTemplating =& KTTemplating::getSingleton(); - $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates'); + $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates'); $dir = dirname(__FILE__); $this->applySQL(realpath($dir . '/sql/script.sql')); @@ -116,7 +116,7 @@ class MultiSelectPlugin extends KTPlugin { $js = ""; $js .= ""; $this->registerAdminPage('ratpfieldset', 'InetDocumentFieldDispatcher', 'documents', - $js._kt('Document Fieldsets (RATP)'), + $js._kt('Document Fieldsets'), _kt('Manage the different types of information with multiselect functionality that can be associated with classes of documents.'), 'InetdocumentFieldsv2.php', null); } diff --git a/plugins/multiselect/inetbasic.inc.php b/plugins/multiselect/inetbasic.inc.php index 1af53ca..e2488e3 100644 --- a/plugins/multiselect/inetbasic.inc.php +++ b/plugins/multiselect/inetbasic.inc.php @@ -107,7 +107,7 @@ class InetBasicFieldsetManagementDispatcher extends KTAdminDispatcher { 'normal' => _kt("Normal (String)"), 'lookup' => _kt("Lookup"), 'tree' => _kt("Tree"), - 'Multiselect' => _kt("Multiselect (RATP)"), + 'Multiselect' => _kt("Multiselect"), ); return $types; } -- libgit2 0.21.4