Commit 043e6837cf591eeae2ce284483a0d84893b371d8

Authored by Kevin G Fourie
1 parent cc4c5edd

Removed extraneous text from MultiSelect plugin.

lib/documentmanagement/DocumentField.inc
@@ -78,7 +78,7 @@ class DocumentField extends KTEntity { @@ -78,7 +78,7 @@ class DocumentField extends KTEntity {
78 var $_aFieldToSelect = array( 78 var $_aFieldToSelect = array(
79 'iId' => 'id', 79 'iId' => 'id',
80 'sName' => 'name', 80 'sName' => 'name',
81 - 'sDescription' => 'description', 81 + 'sDescription' => 'description',
82 'sDataType' => 'data_type', 82 'sDataType' => 'data_type',
83 'bIsGeneric' => 'is_generic', 83 'bIsGeneric' => 'is_generic',
84 'bHasLookup' => 'has_lookup', 84 'bHasLookup' => 'has_lookup',
@@ -93,63 +93,63 @@ class DocumentField extends KTEntity { @@ -93,63 +93,63 @@ class DocumentField extends KTEntity {
93 ); 93 );
94 94
95 // FIXME deprecate constructor use. Use DocumentField::createFromArray instead. 95 // FIXME deprecate constructor use. Use DocumentField::createFromArray instead.
96 - function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null, $bNewIsHTML = null, $iNewMaxLength = null, $bHasNewInetLookup = null, $sNewInetLookupType = null) {  
97 -  
98 - $this->iId = -1;  
99 - $this->sName = $sNewName;  
100 - $this->sDataType = $sNewDataType;  
101 - $this->bIsGeneric = $bNewIsGeneric;  
102 - $this->bHasLookup = $bNewHasLookup;  
103 - $this->iParentFieldset = $iParentFieldset;  
104 - $this->bHasLookupTree = $bHasLookupTree;  
105 - $this->iPosition = $this->getNextFieldPosition($iParentFieldset);  
106 - $this->bIsHTML = $bNewIsHTML;  
107 - $this->iMax = $iNewMaxLength;  
108 - $this->sInetLookupType = $bHasNewInetLookup;  
109 - $this->sInetLookupType = $sNewInetLookupType;  
110 - }  
111 -  
112 - function getID() { return $this->iId; }  
113 - function getName() { return $this->sName; }  
114 - function setName($sNewValue) { $this->sName = $sNewValue; }  
115 - function setDescription($sNewValue) { $this->sDescription = $sNewValue; }  
116 - function getDescription() { return $this->sDescription; }  
117 - function getDataType() { return $this->sDataType; } 96 + function DocumentField($sNewName = null, $sNewDataType = null, $bNewIsGeneric = null, $bNewHasLookup = null, $iParentFieldset = null, $bHasLookupTree = null, $bNewIsHTML = null, $iNewMaxLength = null, $bHasNewInetLookup = null, $sNewInetLookupType = null) {
  97 +
  98 + $this->iId = -1;
  99 + $this->sName = $sNewName;
  100 + $this->sDataType = $sNewDataType;
  101 + $this->bIsGeneric = $bNewIsGeneric;
  102 + $this->bHasLookup = $bNewHasLookup;
  103 + $this->iParentFieldset = $iParentFieldset;
  104 + $this->bHasLookupTree = $bHasLookupTree;
  105 + $this->iPosition = $this->getNextFieldPosition($iParentFieldset);
  106 + $this->bIsHTML = $bNewIsHTML;
  107 + $this->iMax = $iNewMaxLength;
  108 + $this->sInetLookupType = $bHasNewInetLookup;
  109 + $this->sInetLookupType = $sNewInetLookupType;
  110 + }
  111 +
  112 + function getID() { return $this->iId; }
  113 + function getName() { return $this->sName; }
  114 + function setName($sNewValue) { $this->sName = $sNewValue; }
  115 + function setDescription($sNewValue) { $this->sDescription = $sNewValue; }
  116 + function getDescription() { return $this->sDescription; }
  117 + function getDataType() { return $this->sDataType; }
118 function setDataType($sNewValue) { $this->sDataType = $sNewValue; } 118 function setDataType($sNewValue) { $this->sDataType = $sNewValue; }
119 - function getIsGeneric() { return $this->bIsGeneric; }  
120 - function setIsGeneric($sNewValue) { $this->bIsGeneric = $sNewValue; } 119 + function getIsGeneric() { return $this->bIsGeneric; }
  120 + function setIsGeneric($sNewValue) { $this->bIsGeneric = $sNewValue; }
121 function getHasLookup() { return $this->bHasLookup; } 121 function getHasLookup() { return $this->bHasLookup; }
122 - function setHasLookup($iNewValue) { $this->bHasLookup = $iNewValue; } 122 + function setHasLookup($iNewValue) { $this->bHasLookup = $iNewValue; }
123 function getParentFieldset() { return $this->iParentFieldset; } 123 function getParentFieldset() { return $this->iParentFieldset; }
124 - function setParentFieldset($iNewValue) { $this->iParentFieldset = $iNewValue; } 124 + function setParentFieldset($iNewValue) { $this->iParentFieldset = $iNewValue; }
125 function getParentFieldsetId() { return $this->iParentFieldset; } 125 function getParentFieldsetId() { return $this->iParentFieldset; }
126 - function setParentFieldsetId($iNewValue) { $this->iParentFieldset = $iNewValue; } 126 + function setParentFieldsetId($iNewValue) { $this->iParentFieldset = $iNewValue; }
127 function getHasLookupTree() { return $this->bHasLookupTree; } 127 function getHasLookupTree() { return $this->bHasLookupTree; }
128 - function setHasLookupTree($iNewValue) { $this->bHasLookupTree = KTUtil::anyToBool($iNewValue); } 128 + function setHasLookupTree($iNewValue) { $this->bHasLookupTree = KTUtil::anyToBool($iNewValue); }
129 function getIsMandatory() { return $this->bIsMandatory; } 129 function getIsMandatory() { return $this->bIsMandatory; }
130 - function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); } 130 + function setIsMandatory($iNewValue) { $this->bIsMandatory = KTUtil::anyToBool($iNewValue); }
131 function getPosition() { return $this->iPosition; } 131 function getPosition() { return $this->iPosition; }
132 - function setPosition($iNewValue) { $this->iPosition = $iNewValue; } 132 + function setPosition($iNewValue) { $this->iPosition = $iNewValue; }
133 function getIsHTML() { return $this->bIsHTML; } 133 function getIsHTML() { return $this->bIsHTML; }
134 - function setIsHTML($iNewValue) { $this->bIsHTML = $iNewValue; }  
135 - function getMaxLength() { return $this->iMax; }  
136 - function setMaxLength($iNewValue) { $this->iMax = $iNewValue; }  
137 - function getHasInetLookup() { return $this->bHasInetLookup; }  
138 - function setHasInetLookup($iNewValue) { $this->bHasInetLookup = $iNewValue; }  
139 - function getInetLookupType() { return $this->sInetLookupType; }  
140 - function setInetLookupType($sNewValue) { $this->sInetLookupType = $sNewValue; }  
141 - function getInetLookupTypeFriendlyName()  
142 - {  
143 - $aDescriptors = array();  
144 - if($this->getInetLookupType() == "multiwithlist")  
145 - {  
146 - $aDescriptors[] = _kt("Multiselect with a list");  
147 - }  
148 - elseif($this->getInetLookupType() == "multiwithcheckboxes")  
149 - {  
150 - $aDescriptors[] = _kt("Multiselect with checkboxes");  
151 - }  
152 - 134 + function setIsHTML($iNewValue) { $this->bIsHTML = $iNewValue; }
  135 + function getMaxLength() { return $this->iMax; }
  136 + function setMaxLength($iNewValue) { $this->iMax = $iNewValue; }
  137 + function getHasInetLookup() { return $this->bHasInetLookup; }
  138 + function setHasInetLookup($iNewValue) { $this->bHasInetLookup = $iNewValue; }
  139 + function getInetLookupType() { return $this->sInetLookupType; }
  140 + function setInetLookupType($sNewValue) { $this->sInetLookupType = $sNewValue; }
  141 + function getInetLookupTypeFriendlyName()
  142 + {
  143 + $aDescriptors = array();
  144 + if($this->getInetLookupType() == "multiwithlist")
  145 + {
  146 + $aDescriptors[] = _kt("Multiselect with a list");
  147 + }
  148 + elseif($this->getInetLookupType() == "multiwithcheckboxes")
  149 + {
  150 + $aDescriptors[] = _kt("Multiselect with checkboxes");
  151 + }
  152 +
153 // required 153 // required
154 if ($this->getIsMandatory()) { 154 if ($this->getIsMandatory()) {
155 $aDescriptors[] = _kt("Required"); 155 $aDescriptors[] = _kt("Required");
@@ -158,13 +158,13 @@ class DocumentField extends KTEntity { @@ -158,13 +158,13 @@ class DocumentField extends KTEntity {
158 } 158 }
159 159
160 return implode(', ', $aDescriptors); 160 return implode(', ', $aDescriptors);
161 - } 161 + }
162 162
163 163
164 function _fieldValues () { 164 function _fieldValues () {
165 return array( 165 return array(
166 'name' => $this->sName, 166 'name' => $this->sName,
167 - 'description' => $this->sDescription, 167 + 'description' => $this->sDescription,
168 'data_type' => $this->sDataType, 168 'data_type' => $this->sDataType,
169 'is_generic' => KTUtil::anyToBool($this->bIsGeneric), 169 'is_generic' => KTUtil::anyToBool($this->bIsGeneric),
170 'has_lookup' => KTUtil::anyToBool($this->bHasLookup), 170 'has_lookup' => KTUtil::anyToBool($this->bHasLookup),
@@ -185,7 +185,7 @@ class DocumentField extends KTEntity { @@ -185,7 +185,7 @@ class DocumentField extends KTEntity {
185 } 185 }
186 186
187 function &getList($sWhereClause = null) { 187 function &getList($sWhereClause = null) {
188 - return KTEntityUtil::getList2('DocumentField', $sWhereClause); 188 + return KTEntityUtil::getList2('DocumentField', $sWhereClause);
189 } 189 }
190 190
191 function &createFromArray($aOptions) { 191 function &createFromArray($aOptions) {
@@ -226,27 +226,27 @@ class DocumentField extends KTEntity { @@ -226,27 +226,27 @@ class DocumentField extends KTEntity {
226 return KTEntityUtil::get('DocumentField', $iId); 226 return KTEntityUtil::get('DocumentField', $iId);
227 } 227 }
228 228
229 - // FIXME: add a data type class!  
230 - /* Static function. Given a documenttype...will find all fields belongin to it  
231 - *  
232 - * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"]  
233 - */  
234 - function getLookupCount($iDocumentFieldID){  
235 - $sTable = 'metadata';  
236 - $sQuery = "SELECT COUNT(*) AS count FROM " . $sTable . " WHERE document_field_id = ?";  
237 - $aParams = array($iDocumentFieldID); 229 + // FIXME: add a data type class!
  230 + /* Static function. Given a documenttype...will find all fields belongin to it
  231 + *
  232 + * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"]
  233 + */
  234 + function getLookupCount($iDocumentFieldID){
  235 + $sTable = 'metadata';
  236 + $sQuery = "SELECT COUNT(*) AS count FROM " . $sTable . " WHERE document_field_id = ?";
  237 + $aParams = array($iDocumentFieldID);
238 238
239 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'count'); 239 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'count');
240 if (PEAR::isError($res)) { 240 if (PEAR::isError($res)) {
241 return false; // return $res; 241 return false; // return $res;
242 } 242 }
243 return $res; 243 return $res;
244 - } 244 + }
245 245
246 function getType() { 246 function getType() {
247 - if($this->bHasInetLookup){ 247 + if($this->bHasInetLookup){
248 return _kt('Multiselect'); 248 return _kt('Multiselect');
249 - } 249 + }
250 if (empty($this->bHasLookup)) { 250 if (empty($this->bHasLookup)) {
251 return _kt("Normal"); 251 return _kt("Normal");
252 } 252 }
@@ -312,148 +312,148 @@ class DocumentField extends KTEntity { @@ -312,148 +312,148 @@ class DocumentField extends KTEntity {
312 function reorderFields($iFieldsetId) { 312 function reorderFields($iFieldsetId) {
313 // Get the fields in the order they'll appear - first by position then by id 313 // Get the fields in the order they'll appear - first by position then by id
314 $sql = "SELECT id, position FROM document_fields 314 $sql = "SELECT id, position FROM document_fields
315 - WHERE parent_fieldset = ?  
316 - ORDER BY position, id ASC";  
317 - $aParams = array($iFieldsetId); 315 + WHERE parent_fieldset = ?
  316 + ORDER BY position, id ASC";
  317 + $aParams = array($iFieldsetId);
  318 +
  319 + $result = DBUtil::getResultArray(array($sql, $aParams));
  320 +
  321 + if(PEAR::isError($result) || empty($result)){
  322 + return false;
  323 + }
  324 +
  325 + // Set all positions to be unique and in order
  326 + foreach($result as $key => $field){
  327 + $position = $field['position'];
318 328
319 - $result = DBUtil::getResultArray(array($sql, $aParams)); 329 + // If the fields position is correct in the order, continue
  330 + if($position == $key){
  331 + continue;
  332 + }
320 333
321 - if(PEAR::isError($result) || empty($result)){  
322 - return false;  
323 - } 334 + // Reset the position
  335 + $aFields = array();
  336 + $aFields['position'] = $key;
324 337
325 - // Set all positions to be unique and in order  
326 - foreach($result as $key => $field){  
327 - $position = $field['position']; 338 + $res = DBUtil::autoUpdate('document_fields', $aFields, $field['id']);
  339 + }
  340 + return true;
  341 + }
328 342
329 - // If the fields position is correct in the order, continue  
330 - if($position == $key){  
331 - continue;  
332 - } 343 + /**
  344 + * Get the postion of the last field
  345 + */
  346 + function getNextFieldPosition($iFieldsetId){
  347 + $sql = "SELECT position FROM document_fields
  348 + WHERE parent_fieldset = ?
  349 + ORDER BY position DESC LIMIT 1";
  350 + $aParams = array($iFieldsetId);
333 351
334 - // Reset the position  
335 - $aFields = array();  
336 - $aFields['position'] = $key; 352 + $result = DBUtil::getResultArray(array($sql, $aParams));
337 353
338 - $res = DBUtil::autoUpdate('document_fields', $aFields, $field['id']);  
339 - }  
340 - return true; 354 + if(PEAR::isError($result) || empty($result)){
  355 + return 0;
  356 + }
  357 + return $result[0]['position'] + 1;
341 } 358 }
342 359
343 - /**  
344 - * Get the postion of the last field  
345 - */  
346 - function getNextFieldPosition($iFieldsetId){  
347 - $sql = "SELECT position FROM document_fields  
348 - WHERE parent_fieldset = ?  
349 - ORDER BY position DESC LIMIT 1";  
350 - $aParams = array($iFieldsetId);  
351 -  
352 - $result = DBUtil::getResultArray(array($sql, $aParams));  
353 -  
354 - if(PEAR::isError($result) || empty($result)){  
355 - return 0;  
356 - }  
357 - return $result[0]['position'] + 1;  
358 - }  
359 -  
360 - /**  
361 - * Get the next postion up / down  
362 - */  
363 - function getNextPosition($iFieldsetId, $iId, $position, $dir = 'up') {  
364 - switch($dir){  
365 - case 'down':  
366 - $comp = '>';  
367 - $order = 'ASC';  
368 - break;  
369 - default:  
370 - $comp = '<';  
371 - $order = 'DESC';  
372 - }  
373 -  
374 - // Get the column above / below to swop position  
375 - $sql = "SELECT id, position FROM document_fields  
376 - WHERE parent_fieldset = ? AND (position {$comp} ? || (position = ? AND id {$comp} ?))  
377 - ORDER BY position {$order} LIMIT 1";  
378 - $aParams = array($iFieldsetId, $position, $position, $iId);  
379 -  
380 - $result = DBUtil::getOneResult(array($sql, $aParams));  
381 -  
382 - if(PEAR::isError($result) || empty($result)){  
383 - return false;  
384 - }  
385 - return $result;  
386 - }  
387 -  
388 - /**  
389 - * Get the updated position of the field  
390 - *  
391 - * @param int $iId  
392 - * @return int  
393 - */  
394 - function getNewPosition($iId){  
395 - // Get the new position  
396 - $sql = "SELECT id, position FROM document_fields  
397 - WHERE id = ?";  
398 - $aParams = array($iId);  
399 - $result = DBUtil::getOneResult(array($sql, $aParams));  
400 -  
401 - if(PEAR::isError($result) || empty($result)){  
402 - return false;  
403 - }  
404 - return $result['position'];  
405 - }  
406 -  
407 - /**  
408 - * Update the position of a field  
409 - */  
410 - function updatePosition($iId, $position) {  
411 - $aFields = array('position' => $position);  
412 - DBUtil::autoUpdate('document_fields', $aFields, $iId);  
413 - }  
414 -  
415 - /**  
416 - * Move the display position of the field up  
417 - */  
418 - function movePosition($iFieldsetId, $iId, $dir = 'up') {  
419 - $position = $this->getPosition();  
420 -  
421 - // Get the field to swop position with  
422 - $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir);  
423 - if($next === false){  
424 - return false;  
425 - }  
426 -  
427 - // Get position of the next field up / down  
428 - $newPos = $next['position'];  
429 - $iNextId = $next['id'];  
430 -  
431 - if($newPos == $position){  
432 - // 2 fields have the same position - reorder them  
433 - $res = $this->reorderFields($iFieldsetId);  
434 - if($res === false){  
435 - return false;  
436 - }  
437 -  
438 - $position = $this->getNewPosition($iId);  
439 - if($position === false){  
440 - return false;  
441 - }  
442 -  
443 - // Get the field to swop with  
444 - $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir);  
445 - if($next === false){  
446 - return false;  
447 - }  
448 - $newPos = $next['position'];  
449 - $iNextId = $next['id'];  
450 - }  
451 -  
452 - // update the fields  
453 - $this->updatePosition($iId, $newPos);  
454 - $this->updatePosition($iNextId, $position);  
455 - return true;  
456 - } 360 + /**
  361 + * Get the next postion up / down
  362 + */
  363 + function getNextPosition($iFieldsetId, $iId, $position, $dir = 'up') {
  364 + switch($dir){
  365 + case 'down':
  366 + $comp = '>';
  367 + $order = 'ASC';
  368 + break;
  369 + default:
  370 + $comp = '<';
  371 + $order = 'DESC';
  372 + }
  373 +
  374 + // Get the column above / below to swop position
  375 + $sql = "SELECT id, position FROM document_fields
  376 + WHERE parent_fieldset = ? AND (position {$comp} ? || (position = ? AND id {$comp} ?))
  377 + ORDER BY position {$order} LIMIT 1";
  378 + $aParams = array($iFieldsetId, $position, $position, $iId);
  379 +
  380 + $result = DBUtil::getOneResult(array($sql, $aParams));
  381 +
  382 + if(PEAR::isError($result) || empty($result)){
  383 + return false;
  384 + }
  385 + return $result;
  386 + }
  387 +
  388 + /**
  389 + * Get the updated position of the field
  390 + *
  391 + * @param int $iId
  392 + * @return int
  393 + */
  394 + function getNewPosition($iId){
  395 + // Get the new position
  396 + $sql = "SELECT id, position FROM document_fields
  397 + WHERE id = ?";
  398 + $aParams = array($iId);
  399 + $result = DBUtil::getOneResult(array($sql, $aParams));
  400 +
  401 + if(PEAR::isError($result) || empty($result)){
  402 + return false;
  403 + }
  404 + return $result['position'];
  405 + }
  406 +
  407 + /**
  408 + * Update the position of a field
  409 + */
  410 + function updatePosition($iId, $position) {
  411 + $aFields = array('position' => $position);
  412 + DBUtil::autoUpdate('document_fields', $aFields, $iId);
  413 + }
  414 +
  415 + /**
  416 + * Move the display position of the field up
  417 + */
  418 + function movePosition($iFieldsetId, $iId, $dir = 'up') {
  419 + $position = $this->getPosition();
  420 +
  421 + // Get the field to swop position with
  422 + $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir);
  423 + if($next === false){
  424 + return false;
  425 + }
  426 +
  427 + // Get position of the next field up / down
  428 + $newPos = $next['position'];
  429 + $iNextId = $next['id'];
  430 +
  431 + if($newPos == $position){
  432 + // 2 fields have the same position - reorder them
  433 + $res = $this->reorderFields($iFieldsetId);
  434 + if($res === false){
  435 + return false;
  436 + }
  437 +
  438 + $position = $this->getNewPosition($iId);
  439 + if($position === false){
  440 + return false;
  441 + }
  442 +
  443 + // Get the field to swop with
  444 + $next = $this->getNextPosition($iFieldsetId, $iId, $position, $dir);
  445 + if($next === false){
  446 + return false;
  447 + }
  448 + $newPos = $next['position'];
  449 + $iNextId = $next['id'];
  450 + }
  451 +
  452 + // update the fields
  453 + $this->updatePosition($iId, $newPos);
  454 + $this->updatePosition($iNextId, $position);
  455 + return true;
  456 + }
457 } 457 }
458 458
459 /** 459 /**
@@ -461,13 +461,13 @@ class DocumentField extends KTEntity { @@ -461,13 +461,13 @@ class DocumentField extends KTEntity {
461 * 461 *
462 * Creates a document type object from an array 462 * Creates a document type object from an array
463 * 463 *
464 -* @param Array Array of parameters. Must match order of parameters in constructor 464 +* @param Array Array of parameters. Must match order of parameters in constructor
465 * 465 *
466 * @return User user object 466 * @return User user object
467 */ 467 */
468 function & documentfieldCreateFromArray($aParameters) { 468 function & documentfieldCreateFromArray($aParameters) {
469 - $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]);  
470 - return $oDocField; 469 + $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]);
  470 + return $oDocField;
471 } 471 }
472 472
473 473
lib/metadata/fieldsetregistry.inc.php
@@ -102,19 +102,19 @@ class KTFieldsetRegistry { @@ -102,19 +102,19 @@ class KTFieldsetRegistry {
102 $widgets = array(); 102 $widgets = array();
103 $fields = $oFieldset->getFields(); 103 $fields = $oFieldset->getFields();
104 104
105 - if ($oFieldset->getIsConditional()) {  
106 - $iMasterId = $oFieldset->getMasterFieldId();  
107 -  
108 - $oMasterField = DocumentField::get($iMasterId);  
109 -  
110 - $newfields = array();  
111 - $newfields[] = $oMasterField;  
112 - foreach($fields as $oField) {  
113 - if($oField->getId() != $iMasterId) {  
114 - $newfields[] = $oField;  
115 - }  
116 - }  
117 - 105 + if ($oFieldset->getIsConditional()) {
  106 + $iMasterId = $oFieldset->getMasterFieldId();
  107 +
  108 + $oMasterField = DocumentField::get($iMasterId);
  109 +
  110 + $newfields = array();
  111 + $newfields[] = $oMasterField;
  112 + foreach($fields as $oField) {
  113 + if($oField->getId() != $iMasterId) {
  114 + $newfields[] = $oField;
  115 + }
  116 + }
  117 +
118 foreach ($newfields as $oField) { 118 foreach ($newfields as $oField) {
119 $fname = 'metadata_' . $oField->getId(); 119 $fname = 'metadata_' . $oField->getId();
120 $value = null; 120 $value = null;
@@ -126,23 +126,23 @@ class KTFieldsetRegistry { @@ -126,23 +126,23 @@ class KTFieldsetRegistry {
126 } 126 }
127 } 127 }
128 128
129 - $widgets[] = $this->oWF->get('ktcore.widgets.conditionalselection',  
130 - array(  
131 - 'label' => $oField->getName(),  
132 - 'required' => $oField->getIsMandatory(),  
133 - 'name' => $fname,  
134 - 'value' => $value,  
135 - 'description' => $oField->getDescription(),  
136 - 'vocab' => MetaData::getEnabledByDocumentField($oField),  
137 - 'id_method' => 'getName',  
138 - 'label_method' => 'getName',  
139 - 'unselected_label' => _kt("No selection."),  
140 - 'simple_select' => false,  
141 - 'master' => ($oField->getId() == $iMasterId),  
142 - 'masterid' => $iMasterId,  
143 - 'fieldset' => $oFieldset->getId(),  
144 - 'field' => $oField->getId(),  
145 - )); 129 + $widgets[] = $this->oWF->get('ktcore.widgets.conditionalselection',
  130 + array(
  131 + 'label' => $oField->getName(),
  132 + 'required' => $oField->getIsMandatory(),
  133 + 'name' => $fname,
  134 + 'value' => $value,
  135 + 'description' => $oField->getDescription(),
  136 + 'vocab' => MetaData::getEnabledByDocumentField($oField),
  137 + 'id_method' => 'getName',
  138 + 'label_method' => 'getName',
  139 + 'unselected_label' => _kt("No selection."),
  140 + 'simple_select' => false,
  141 + 'master' => ($oField->getId() == $iMasterId),
  142 + 'masterid' => $iMasterId,
  143 + 'fieldset' => $oFieldset->getId(),
  144 + 'field' => $oField->getId(),
  145 + ));
146 } 146 }
147 } else { 147 } else {
148 foreach ($fields as $oField) { 148 foreach ($fields as $oField) {
@@ -170,13 +170,13 @@ class KTFieldsetRegistry { @@ -170,13 +170,13 @@ class KTFieldsetRegistry {
170 $type = 'ktcore.fields.lookup'; 170 $type = 'ktcore.fields.lookup';
171 } 171 }
172 } else if($oField->getHasInetLookup()) { 172 } else if($oField->getHasInetLookup()) {
173 - $type = 'ktcore.fields.multiselect';  
174 - } else { 173 + $type = 'ktcore.fields.multiselect';
  174 + } else {
175 $type = 'ktcore.fields.string'; 175 $type = 'ktcore.fields.string';
176 } 176 }
177 177
178 if ($oField->getDataType() == 'LARGE TEXT') { 178 if ($oField->getDataType() == 'LARGE TEXT') {
179 - $type = 'ktcore.fields.largetext'; 179 + $type = 'ktcore.fields.largetext';
180 } else if ($oField->getDataType() == 'DATE') { 180 } else if ($oField->getDataType() == 'DATE') {
181 $type = 'ktcore.fields.date'; 181 $type = 'ktcore.fields.date';
182 } 182 }
@@ -212,7 +212,7 @@ class KTFieldsetRegistry { @@ -212,7 +212,7 @@ class KTFieldsetRegistry {
212 'vocab' => MetaData::getEnabledByDocumentField($oField), 212 'vocab' => MetaData::getEnabledByDocumentField($oField),
213 'field_id' => $oField->getId(), 213 'field_id' => $oField->getId(),
214 )); 214 ));
215 - } else if ($type == 'ktcore.fields.largetext') { 215 + } else if ($type == 'ktcore.fields.largetext') {
216 $widgets[] = $this->oWF->get('ktcore.widgets.textarea', array( 216 $widgets[] = $this->oWF->get('ktcore.widgets.textarea', array(
217 'label' => $oField->getName(), 217 'label' => $oField->getName(),
218 'required' => $oField->getIsMandatory(), 218 'required' => $oField->getIsMandatory(),
@@ -221,7 +221,7 @@ class KTFieldsetRegistry { @@ -221,7 +221,7 @@ class KTFieldsetRegistry {
221 'description' => $oField->getDescription(), 221 'description' => $oField->getDescription(),
222 'field' => $oField, 222 'field' => $oField,
223 )); 223 ));
224 - } else if ($type == 'ktcore.fields.date') { 224 + } else if ($type == 'ktcore.fields.date') {
225 $widgets[] = $this->oWF->get('ktcore.widgets.date', array( 225 $widgets[] = $this->oWF->get('ktcore.widgets.date', array(
226 'label' => $oField->getName(), 226 'label' => $oField->getName(),
227 'required' => $oField->getIsMandatory(), 227 'required' => $oField->getIsMandatory(),
@@ -230,50 +230,50 @@ class KTFieldsetRegistry { @@ -230,50 +230,50 @@ class KTFieldsetRegistry {
230 'description' => $oField->getDescription(), 230 'description' => $oField->getDescription(),
231 )); 231 ));
232 } else if ($type == 'ktcore.fields.multiselect') { 232 } else if ($type == 'ktcore.fields.multiselect') {
233 - if($oField->getInetLookupType() == "multiwithlist") {  
234 - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(  
235 - 'label' => $oField->getName(),  
236 - 'required' => $oField->getIsMandatory(),  
237 - 'name' => $fname,  
238 - 'value' => explode(", ",$value),  
239 - 'description' => $oField->getDescription(),  
240 - 'vocab' => MetaData::getEnabledByDocumentField($oField),  
241 - 'id_method' => 'getName',  
242 - 'label_method' => 'getName',  
243 - 'unselected_label' => false,  
244 - 'simple_select' => false,  
245 - 'multi'=> true,  
246 - ));  
247 - } else if($oField->getInetLookupType() == "multiwithcheckboxes") {  
248 - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(  
249 - 'label' => $oField->getName(),  
250 - 'required' => $oField->getIsMandatory(),  
251 - 'name' => $fname,  
252 - 'value' => explode(", ",$value),  
253 - 'description' => $oField->getDescription(),  
254 - 'vocab' => MetaData::getEnabledByDocumentField($oField), 233 + if($oField->getInetLookupType() == "multiwithlist") {
  234 + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(
  235 + 'label' => $oField->getName(),
  236 + 'required' => $oField->getIsMandatory(),
  237 + 'name' => $fname,
  238 + 'value' => explode(", ",$value),
  239 + 'description' => $oField->getDescription(),
  240 + 'vocab' => MetaData::getEnabledByDocumentField($oField),
  241 + 'id_method' => 'getName',
  242 + 'label_method' => 'getName',
  243 + 'unselected_label' => false,
  244 + 'simple_select' => false,
  245 + 'multi'=> true,
  246 + ));
  247 + } else if($oField->getInetLookupType() == "multiwithcheckboxes") {
  248 + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(
  249 + 'label' => $oField->getName(),
  250 + 'required' => $oField->getIsMandatory(),
  251 + 'name' => $fname,
  252 + 'value' => explode(", ",$value),
  253 + 'description' => $oField->getDescription(),
  254 + 'vocab' => MetaData::getEnabledByDocumentField($oField),
255 'field_id' => $oField->getId(), 255 'field_id' => $oField->getId(),
256 - 'id_method' => 'getName',  
257 - 'label_method' => 'getName',  
258 - 'unselected_label' => false,  
259 - 'simple_select' => true,  
260 - 'multi'=> true,  
261 - ));  
262 - } else {  
263 - $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(  
264 - 'label' => $oField->getName(),  
265 - 'required' => $oField->getIsMandatory(),  
266 - 'name' => $fname,  
267 - 'value' => $value,  
268 - 'description' => $oField->getDescription(), 256 + 'id_method' => 'getName',
  257 + 'label_method' => 'getName',
  258 + 'unselected_label' => false,
  259 + 'simple_select' => true,
  260 + 'multi'=> true,
  261 + ));
  262 + } else {
  263 + $widgets[] = $this->oWF->get('ktcore.widgets.entityselection', array(
  264 + 'label' => $oField->getName(),
  265 + 'required' => $oField->getIsMandatory(),
  266 + 'name' => $fname,
  267 + 'value' => $value,
  268 + 'description' => $oField->getDescription(),
269 'field' => $oField, 269 'field' => $oField,
270 - 'vocab' => MetaData::getEnabledByDocumentField($oField),  
271 - 'id_method' => 'getName',  
272 - 'label_method' => 'getName',  
273 - 'unselected_label' => _kt("No selection."),  
274 - 'simple_select' => false,  
275 - ));  
276 - } 270 + 'vocab' => MetaData::getEnabledByDocumentField($oField),
  271 + 'id_method' => 'getName',
  272 + 'label_method' => 'getName',
  273 + 'unselected_label' => _kt("No selection."),
  274 + 'simple_select' => false,
  275 + ));
  276 + }
277 277
278 } else if ($type == 'ktcore.fields.tree') { 278 } else if ($type == 'ktcore.fields.tree') {
279 $widgets[] = $this->oWF->get('ktcore.widgets.treemetadata', array( 279 $widgets[] = $this->oWF->get('ktcore.widgets.treemetadata', array(
@@ -290,15 +290,15 @@ class KTFieldsetRegistry { @@ -290,15 +290,15 @@ class KTFieldsetRegistry {
290 290
291 291
292 } 292 }
293 -  
294 - return array($this->oWF->get('ktcore.widgets.fieldset',  
295 - array( 293 +
  294 + return array($this->oWF->get('ktcore.widgets.fieldset',
  295 + array(
296 'label' => $oFieldset->getName(), 296 'label' => $oFieldset->getName(),
297 'description' => $oFieldset->getDescription(), 297 'description' => $oFieldset->getDescription(),
298 'name' => $sContainerName, 298 'name' => $sContainerName,
299 'widgets' => $widgets, 299 'widgets' => $widgets,
300 ))); 300 )));
301 - 301 +
302 } 302 }
303 303
304 304
@@ -322,15 +322,15 @@ class KTFieldsetRegistry { @@ -322,15 +322,15 @@ class KTFieldsetRegistry {
322 foreach ($fields as $oField) { 322 foreach ($fields as $oField) {
323 $fname = 'metadata_' . $oField->getId(); 323 $fname = 'metadata_' . $oField->getId();
324 324
325 - // Change back to 'membership'  
326 - $validators[] = $this->oVF->get('ktcore.validators.membership',  
327 - array(  
328 - 'test' => $fname,  
329 - 'output' => $fname,  
330 - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),  
331 - 'id_method' => 'getName',  
332 - ));  
333 - } 325 + // Change back to 'membership'
  326 + $validators[] = $this->oVF->get('ktcore.validators.membership',
  327 + array(
  328 + 'test' => $fname,
  329 + 'output' => $fname,
  330 + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),
  331 + 'id_method' => 'getName',
  332 + ));
  333 + }
334 } else { 334 } else {
335 $validators = array(); 335 $validators = array();
336 $fields = $oFieldset->getFields(); 336 $fields = $oFieldset->getFields();
@@ -359,8 +359,8 @@ class KTFieldsetRegistry { @@ -359,8 +359,8 @@ class KTFieldsetRegistry {
359 $type = 'ktcore.fields.lookup'; 359 $type = 'ktcore.fields.lookup';
360 } 360 }
361 } else if($oField->getHasInetLookup()) { 361 } else if($oField->getHasInetLookup()) {
362 - $type = 'ktcore.fields.multiselect';  
363 - } else { 362 + $type = 'ktcore.fields.multiselect';
  363 + } else {
364 $type = 'ktcore.fields.string'; 364 $type = 'ktcore.fields.string';
365 } 365 }
366 366
@@ -387,35 +387,35 @@ class KTFieldsetRegistry { @@ -387,35 +387,35 @@ class KTFieldsetRegistry {
387 'id_method' => 'getName', 387 'id_method' => 'getName',
388 )); 388 ));
389 } else if ($type == 'ktcore.fields.multiselect') { 389 } else if ($type == 'ktcore.fields.multiselect') {
390 - if($oField->getInetLookupType() == "multiwithlist")  
391 - {  
392 - $validators[] = $this->oVF->get('ktcore.validators.membership',array(  
393 - 'test' => $fname,  
394 - 'output' => $fname,  
395 - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),  
396 - 'id_method' => 'getName',  
397 - 'multi' => true,  
398 - ));  
399 - }  
400 - else if($oField->getInetLookupType() == "multiwithcheckboxes")  
401 - {  
402 - $validators[] = $this->oVF->get('ktcore.validators.membership',array(  
403 - 'test' => $fname,  
404 - 'output' => $fname,  
405 - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),  
406 - 'id_method' => 'getName',  
407 - 'multi' => true,  
408 - ));  
409 - }  
410 - else  
411 - {  
412 - $validators[] = $this->oVF->get('ktcore.validators.membership',array(  
413 - 'test' => $fname,  
414 - 'output' => $fname,  
415 - 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),  
416 - 'id_method' => 'getName',  
417 - ));  
418 - } 390 + if($oField->getInetLookupType() == "multiwithlist")
  391 + {
  392 + $validators[] = $this->oVF->get('ktcore.validators.membership',array(
  393 + 'test' => $fname,
  394 + 'output' => $fname,
  395 + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),
  396 + 'id_method' => 'getName',
  397 + 'multi' => true,
  398 + ));
  399 + }
  400 + else if($oField->getInetLookupType() == "multiwithcheckboxes")
  401 + {
  402 + $validators[] = $this->oVF->get('ktcore.validators.membership',array(
  403 + 'test' => $fname,
  404 + 'output' => $fname,
  405 + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),
  406 + 'id_method' => 'getName',
  407 + 'multi' => true,
  408 + ));
  409 + }
  410 + else
  411 + {
  412 + $validators[] = $this->oVF->get('ktcore.validators.membership',array(
  413 + 'test' => $fname,
  414 + 'output' => $fname,
  415 + 'vocab' => MetaData::getEnabledValuesByDocumentField($oField),
  416 + 'id_method' => 'getName',
  417 + ));
  418 + }
419 419
420 } else { 420 } else {
421 $validators[] = PEAR::raiseError(sprintf(_kt("Unable to deal with field: id %d"), $oField->getId())); 421 $validators[] = PEAR::raiseError(sprintf(_kt("Unable to deal with field: id %d"), $oField->getId()));
@@ -423,8 +423,8 @@ class KTFieldsetRegistry { @@ -423,8 +423,8 @@ class KTFieldsetRegistry {
423 } 423 }
424 424
425 } 425 }
426 - return array($this->oVF->get('ktcore.validators.fieldset',  
427 - array( 426 + return array($this->oVF->get('ktcore.validators.fieldset',
  427 + array(
428 'test' => $sContainerName, 428 'test' => $sContainerName,
429 'output' => $sContainerName, 429 'output' => $sContainerName,
430 'validators' => $validators, 430 'validators' => $validators,
lib/search/searchutil.inc.php
@@ -63,7 +63,7 @@ class KTSearchUtil { @@ -63,7 +63,7 @@ class KTSearchUtil {
63 $type = KTUtil::arrayGet($dataset, "type"); 63 $type = KTUtil::arrayGet($dataset, "type");
64 $sql = KTUtil::arrayGet($dataset, "sql"); 64 $sql = KTUtil::arrayGet($dataset, "sql");
65 if (!empty($type)) { 65 if (!empty($type)) {
66 - $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); 66 + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
67 $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']); 67 $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']);
68 if (PEAR::isError($oCriterion)) { 68 if (PEAR::isError($oCriterion)) {
69 return PEAR::raiseError(_kt('Invalid criteria specified.')); 69 return PEAR::raiseError(_kt('Invalid criteria specified.'));
@@ -84,46 +84,46 @@ class KTSearchUtil { @@ -84,46 +84,46 @@ class KTSearchUtil {
84 $aReq = $oCriterionPair[1]; 84 $aReq = $oCriterionPair[1];
85 85
86 if (is_object($oCriterion)) { 86 if (is_object($oCriterion)) {
87 - if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin'))  
88 - {  
89 - //$newAReq = $aReq;  
90 - $aNewSQL = array();  
91 - foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval)  
92 - {  
93 - $newAReq = $aReq;  
94 - $newAReq[$oCriterion->sNamespace] = $vval;  
95 - $res = $oCriterion->searchSQL($newAReq);  
96 - if (!is_null($res)) {  
97 - $aNewSQL[] = $res;  
98 - }  
99 - }  
100 -  
101 - $aNewSQL0 = array();  
102 - $aNewSQL1 = array();  
103 - foreach($aNewSQL as $ind=>$sQ)  
104 - {  
105 - $aNewSQL0[] = $sQ[0];  
106 - $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]);  
107 - }  
108 -  
109 - $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 );  
110 -  
111 - $res = $oCriterion->searchJoinSQL();  
112 - if (!is_null($res)) {  
113 - $aJoinSQL[] = $res;  
114 - }  
115 - }  
116 - else  
117 - {  
118 - $res = $oCriterion->searchSQL($aReq);  
119 - if (!is_null($res)) {  
120 - $aSQL[] = $res;  
121 - }  
122 - $res = $oCriterion->searchJoinSQL();  
123 - if (!is_null($res)) {  
124 - $aJoinSQL[] = $res;  
125 - }  
126 - } 87 + if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin'))
  88 + {
  89 + //$newAReq = $aReq;
  90 + $aNewSQL = array();
  91 + foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval)
  92 + {
  93 + $newAReq = $aReq;
  94 + $newAReq[$oCriterion->sNamespace] = $vval;
  95 + $res = $oCriterion->searchSQL($newAReq);
  96 + if (!is_null($res)) {
  97 + $aNewSQL[] = $res;
  98 + }
  99 + }
  100 +
  101 + $aNewSQL0 = array();
  102 + $aNewSQL1 = array();
  103 + foreach($aNewSQL as $ind=>$sQ)
  104 + {
  105 + $aNewSQL0[] = $sQ[0];
  106 + $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]);
  107 + }
  108 +
  109 + $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 );
  110 +
  111 + $res = $oCriterion->searchJoinSQL();
  112 + if (!is_null($res)) {
  113 + $aJoinSQL[] = $res;
  114 + }
  115 + }
  116 + else
  117 + {
  118 + $res = $oCriterion->searchSQL($aReq);
  119 + if (!is_null($res)) {
  120 + $aSQL[] = $res;
  121 + }
  122 + $res = $oCriterion->searchJoinSQL();
  123 + if (!is_null($res)) {
  124 + $aJoinSQL[] = $res;
  125 + }
  126 + }
127 } else { 127 } else {
128 $aSQL[] = array($oCriterion, $aReq); 128 $aSQL[] = array($oCriterion, $aReq);
129 } 129 }
@@ -152,137 +152,137 @@ class KTSearchUtil { @@ -152,137 +152,137 @@ class KTSearchUtil {
152 } 152 }
153 // }}} 153 // }}}
154 154
155 - /**  
156 - * All for folders only 155 + /**
  156 + * All for folders only
157 * Handles leaf criteria set (ie, no subgroups), generating SQL for 157 * Handles leaf criteria set (ie, no subgroups), generating SQL for
158 * the values in the criteria. 158 * the values in the criteria.
159 * 159 *
160 * (This would be the place to extend criteria to support contains, 160 * (This would be the place to extend criteria to support contains,
161 * starts with, ends with, greater than, and so forth.) 161 * starts with, ends with, greater than, and so forth.)
162 */ 162 */
163 - function _oneCriteriaFolderSetToSQL($aOneCriteriaSet) {  
164 - $aSQL = array();  
165 - $aJoinSQL = array();  
166 - $criteria_set = array();  
167 -  
168 - /*  
169 - * First phase: get criterion object for search or the direct  
170 - * SQL to use.  
171 - *  
172 - * XXX: Why is there $order there?  
173 - */  
174 - foreach ($aOneCriteriaSet as $order => $dataset) {  
175 - $type = KTUtil::arrayGet($dataset, "type");  
176 - $sql = KTUtil::arrayGet($dataset, "sql");  
177 - if (!empty($type)) {  
178 - $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();  
179 - $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']);  
180 -  
181 - if (PEAR::isError($oCriterion)) {  
182 - return PEAR::raiseError(_kt('Invalid criteria specified.'));  
183 - }  
184 - $criteria_set[] = array($oCriterion, $dataset["data"]);  
185 - } else if (!empty($sql)) {  
186 - $criteria_set[] = $sql;  
187 - } else {  
188 - return PEAR::raiseError(_kt('Invalid criteria specified.'));  
189 - }  
190 - }  
191 -  
192 - /*  
193 - * Second phase: Create an individual SQL query per criteria.  
194 - */  
195 - foreach ($criteria_set as $oCriterionPair) {  
196 - $oCriterion->aLookup[table]='folder_field_links';  
197 -  
198 - $oCriterion = $oCriterionPair[0];  
199 - $aReq = $oCriterionPair[1];  
200 -  
201 -  
202 -  
203 -  
204 - if (is_object($oCriterion)) {  
205 - // changed by dp start // for multiselect search for folders  
206 - if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin'))  
207 - {  
208 - $aNewSQL = array();  
209 - foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval)  
210 - {  
211 - $newAReq = $aReq;  
212 - $newAReq[$oCriterion->sNamespace] = $vval;  
213 - $res = $oCriterion->searchSQL($newAReq);  
214 - if (!is_null($res)) {  
215 - $aNewSQL[] = $res;  
216 - }  
217 - }  
218 -  
219 - $aNewSQL0 = array();  
220 - $aNewSQL1 = array();  
221 - foreach($aNewSQL as $ind=>$sQ)  
222 - {  
223 - $aNewSQL0[] = $sQ[0];  
224 - $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]);  
225 - }  
226 - $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 );  
227 - $res = $oCriterion->searchJoinSQL();  
228 - if (!is_null($res)) {  
229 - if(strstr($res,'D.metadata_version_id')){  
230 - $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res);  
231 - }  
232 - if(strstr($res,'document_fields_link')){  
233 - $res=str_replace('document_fields_link','folder_fields_link',$res);  
234 - }  
235 - $aJoinSQL[] = $res;  
236 - }  
237 - }// changed by dp end // for multiselect search for folders  
238 - else  
239 - {  
240 - $res = $oCriterion->searchSQL($aReq);  
241 - if (!is_null($res)) {  
242 - $aSQL[] = $res;  
243 - }  
244 - $res = $oCriterion->searchJoinSQL();  
245 - if (!is_null($res)) {  
246 -  
247 - if(strstr($res,'D.metadata_version_id')){  
248 - $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res);  
249 - }  
250 - if(strstr($res,'document_fields_link')){  
251 - $res=str_replace('document_fields_link','folder_fields_link',$res);  
252 - }  
253 - $aJoinSQL[] = $res;  
254 - }  
255 - }  
256 -  
257 - } else {  
258 - $aSQL[] = array($oCriterion, $aReq);  
259 - }  
260 - }  
261 -  
262 - /*  
263 - * Third phase: build up $aCritQueries and $aCritParams, and put  
264 - * parentheses around them.  
265 - */  
266 - $aCritParams = array();  
267 - $aCritQueries = array();  
268 - foreach ($aSQL as $sSQL) {  
269 - if (is_array($sSQL)) {  
270 - $aCritQueries[] = '('.$sSQL[0].')';  
271 - $aCritParams = kt_array_merge($aCritParams , $sSQL[1]);  
272 - } else {  
273 - $aCritQueries[] = '('.$sSQL.')';  
274 - }  
275 - }  
276 -  
277 -  
278 - if (count($aCritQueries) == 0) {  
279 - return PEAR::raiseError(_kt("No search criteria were specified"));  
280 - }  
281 -  
282 - return array($aCritQueries, $aCritParams, $aJoinSQL);  
283 - }  
284 - /**  
285 - * All for folders 163 + function _oneCriteriaFolderSetToSQL($aOneCriteriaSet) {
  164 + $aSQL = array();
  165 + $aJoinSQL = array();
  166 + $criteria_set = array();
  167 +
  168 + /*
  169 + * First phase: get criterion object for search or the direct
  170 + * SQL to use.
  171 + *
  172 + * XXX: Why is there $order there?
  173 + */
  174 + foreach ($aOneCriteriaSet as $order => $dataset) {
  175 + $type = KTUtil::arrayGet($dataset, "type");
  176 + $sql = KTUtil::arrayGet($dataset, "sql");
  177 + if (!empty($type)) {
  178 + $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
  179 + $oCriterion = $oCriteriaRegistry->getCriterion($dataset['type']);
  180 +
  181 + if (PEAR::isError($oCriterion)) {
  182 + return PEAR::raiseError(_kt('Invalid criteria specified.'));
  183 + }
  184 + $criteria_set[] = array($oCriterion, $dataset["data"]);
  185 + } else if (!empty($sql)) {
  186 + $criteria_set[] = $sql;
  187 + } else {
  188 + return PEAR::raiseError(_kt('Invalid criteria specified.'));
  189 + }
  190 + }
  191 +
  192 + /*
  193 + * Second phase: Create an individual SQL query per criteria.
  194 + */
  195 + foreach ($criteria_set as $oCriterionPair) {
  196 + $oCriterion->aLookup[table]='folder_field_links';
  197 +
  198 + $oCriterion = $oCriterionPair[0];
  199 + $aReq = $oCriterionPair[1];
  200 +
  201 +
  202 +
  203 +
  204 + if (is_object($oCriterion)) {
  205 + // changed by dp start // for multiselect search for folders
  206 + if(is_array($aReq[$oCriterion->sNamespace]) && KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin'))
  207 + {
  208 + $aNewSQL = array();
  209 + foreach($aReq[$oCriterion->sNamespace] as $kkey => $vval)
  210 + {
  211 + $newAReq = $aReq;
  212 + $newAReq[$oCriterion->sNamespace] = $vval;
  213 + $res = $oCriterion->searchSQL($newAReq);
  214 + if (!is_null($res)) {
  215 + $aNewSQL[] = $res;
  216 + }
  217 + }
  218 +
  219 + $aNewSQL0 = array();
  220 + $aNewSQL1 = array();
  221 + foreach($aNewSQL as $ind=>$sQ)
  222 + {
  223 + $aNewSQL0[] = $sQ[0];
  224 + $aNewSQL1 = array_merge($aNewSQL1,$sQ[1]);
  225 + }
  226 + $aSQL[] = array(" ( ".join(" ) ".$aReq[$oCriterion->sNamespace."_join"]." ( ", $aNewSQL0)." ) ",$aNewSQL1 );
  227 + $res = $oCriterion->searchJoinSQL();
  228 + if (!is_null($res)) {
  229 + if(strstr($res,'D.metadata_version_id')){
  230 + $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res);
  231 + }
  232 + if(strstr($res,'document_fields_link')){
  233 + $res=str_replace('document_fields_link','folder_fields_link',$res);
  234 + }
  235 + $aJoinSQL[] = $res;
  236 + }
  237 + }// changed by dp end // for multiselect search for folders
  238 + else
  239 + {
  240 + $res = $oCriterion->searchSQL($aReq);
  241 + if (!is_null($res)) {
  242 + $aSQL[] = $res;
  243 + }
  244 + $res = $oCriterion->searchJoinSQL();
  245 + if (!is_null($res)) {
  246 +
  247 + if(strstr($res,'D.metadata_version_id')){
  248 + $res=str_replace('D.metadata_version_id','F.metadata_version_id',$res);
  249 + }
  250 + if(strstr($res,'document_fields_link')){
  251 + $res=str_replace('document_fields_link','folder_fields_link',$res);
  252 + }
  253 + $aJoinSQL[] = $res;
  254 + }
  255 + }
  256 +
  257 + } else {
  258 + $aSQL[] = array($oCriterion, $aReq);
  259 + }
  260 + }
  261 +
  262 + /*
  263 + * Third phase: build up $aCritQueries and $aCritParams, and put
  264 + * parentheses around them.
  265 + */
  266 + $aCritParams = array();
  267 + $aCritQueries = array();
  268 + foreach ($aSQL as $sSQL) {
  269 + if (is_array($sSQL)) {
  270 + $aCritQueries[] = '('.$sSQL[0].')';
  271 + $aCritParams = kt_array_merge($aCritParams , $sSQL[1]);
  272 + } else {
  273 + $aCritQueries[] = '('.$sSQL.')';
  274 + }
  275 + }
  276 +
  277 +
  278 + if (count($aCritQueries) == 0) {
  279 + return PEAR::raiseError(_kt("No search criteria were specified"));
  280 + }
  281 +
  282 + return array($aCritQueries, $aCritParams, $aJoinSQL);
  283 + }
  284 + /**
  285 + * All for folders
286 * Converts a criteria set to the SQL joins, where clause, and 286 * Converts a criteria set to the SQL joins, where clause, and
287 * parameters necessary to ensure that the criteria listed restrict 287 * parameters necessary to ensure that the criteria listed restrict
288 * the folders returned to those that match the criteria. 288 * the folders returned to those that match the criteria.
@@ -295,7 +295,7 @@ class KTSearchUtil { @@ -295,7 +295,7 @@ class KTSearchUtil {
295 * - Array of parameters that go with the where clause 295 * - Array of parameters that go with the where clause
296 * - String with the SQL necessary to join with the tables in the 296 * - String with the SQL necessary to join with the tables in the
297 * where clause 297 * where clause
298 - */ 298 + */
299 function criteriaFolderSetToSQL($aCriteriaSet, $iRecurseLevel = 0) { 299 function criteriaFolderSetToSQL($aCriteriaSet, $iRecurseLevel = 0) {
300 $aJoinSQL = array(); 300 $aJoinSQL = array();
301 $aSearchStrings = array(); 301 $aSearchStrings = array();
@@ -315,18 +315,18 @@ class KTSearchUtil { @@ -315,18 +315,18 @@ class KTSearchUtil {
315 $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup"); 315 $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup");
316 if (!empty($aValues)) { 316 if (!empty($aValues)) {
317 317
318 - $res = KTSearchUtil::_oneCriteriaFolderSetToSQL($aOneCriteriaSet["values"]);  
319 -  
320 - if(PEAR::isError($res)) {  
321 - return $res;  
322 - }  
323 - list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res;  
324 - $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL);  
325 - $aParams = kt_array_merge($aParams, $aThisParams);  
326 - $tabs = str_repeat("\t", ($iRecurseLevel + 2));  
327 - $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; 318 + $res = KTSearchUtil::_oneCriteriaFolderSetToSQL($aOneCriteriaSet["values"]);
  319 +
  320 + if(PEAR::isError($res)) {
  321 + return $res;
  322 + }
  323 + list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res;
  324 + $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL);
  325 + $aParams = kt_array_merge($aParams, $aThisParams);
  326 + $tabs = str_repeat("\t", ($iRecurseLevel + 2));
  327 + $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)";
328 } else if (!empty($aSubgroup)) { 328 } else if (!empty($aSubgroup)) {
329 - 329 +
330 /* 330 /*
331 * Recurse if we have a criteria set with subgroups. 331 * Recurse if we have a criteria set with subgroups.
332 * Recurselevel makes the tabs increase as we recurse so 332 * Recurselevel makes the tabs increase as we recurse so
@@ -346,9 +346,9 @@ class KTSearchUtil { @@ -346,9 +346,9 @@ class KTSearchUtil {
346 346
347 return array($sSearchString, $aParams, $sJoinSQL); 347 return array($sSearchString, $aParams, $sJoinSQL);
348 } 348 }
349 -  
350 - /**  
351 - * All for folders 349 +
  350 + /**
  351 + * All for folders
352 * Converts a criteria set into a SQL query that (by default) 352 * Converts a criteria set into a SQL query that (by default)
353 * returns the ids of documents that fulfil the criteria. 353 * returns the ids of documents that fulfil the criteria.
354 * 354 *
@@ -362,7 +362,7 @@ class KTSearchUtil { @@ -362,7 +362,7 @@ class KTSearchUtil {
362 * - String containing the parameterised SQL query 362 * - String containing the parameterised SQL query
363 * - Array containing the parameters for the SQL query 363 * - Array containing the parameters for the SQL query
364 */ 364 */
365 - function criteriaToFolderQuery($aCriteriaSet, $oUser, $sPermissionName, $aOptions = null) { 365 + function criteriaToFolderQuery($aCriteriaSet, $oUser, $sPermissionName, $aOptions = null) {
366 global $default; 366 global $default;
367 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id AS folder_id'); 367 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id AS folder_id');
368 $sInitialJoin = KTUtil::arrayGet($aOptions, 'join', ''); 368 $sInitialJoin = KTUtil::arrayGet($aOptions, 'join', '');
@@ -371,15 +371,15 @@ class KTSearchUtil { @@ -371,15 +371,15 @@ class KTSearchUtil {
371 $sInitialJoin = $sInitialJoin[0]; 371 $sInitialJoin = $sInitialJoin[0];
372 } 372 }
373 373
374 - $res = KTSearchUtil::criteriaFolderSetToSQL($aCriteriaSet); 374 + $res = KTSearchUtil::criteriaFolderSetToSQL($aCriteriaSet);
375 375
376 - if(PEAR::isError($res)) return $res; 376 + if(PEAR::isError($res)) return $res;
377 list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res; 377 list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res;
378 378
379 $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version. 379 $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version.
380 380
381 $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName); 381 $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName);
382 - 382 +
383 if (PEAR::isError($res)) { // only occurs if the group has no permissions. 383 if (PEAR::isError($res)) { // only occurs if the group has no permissions.
384 return $res; 384 return $res;
385 } else { 385 } else {
@@ -433,17 +433,17 @@ class KTSearchUtil { @@ -433,17 +433,17 @@ class KTSearchUtil {
433 $aParams = kt_array_merge($aParams, $aInitialJoinParams); 433 $aParams = kt_array_merge($aParams, $aInitialJoinParams);
434 $aParams = kt_array_merge($aParams, $aPermissionParams); 434 $aParams = kt_array_merge($aParams, $aPermissionParams);
435 435
436 - if($sToSearch!='Live') 436 + if($sToSearch!='Live')
437 $aParams[] = $sToSearch; 437 $aParams[] = $sToSearch;
438 $aParams = kt_array_merge($aParams, $aCritParams); 438 $aParams = kt_array_merge($aParams, $aCritParams);
439 -  
440 -  
441 - if(strstr($sQuery,'document_field_id')){  
442 - $sQuery=str_replace('document_field_id','folder_field_id',$sQuery);  
443 - }  
444 - if(strstr($sQuery,'D.creator_id')){  
445 - $sQuery=str_replace('D.creator_id','F.creator_id',$sQuery);  
446 - } 439 +
  440 +
  441 + if(strstr($sQuery,'document_field_id')){
  442 + $sQuery=str_replace('document_field_id','folder_field_id',$sQuery);
  443 + }
  444 + if(strstr($sQuery,'D.creator_id')){
  445 + $sQuery=str_replace('D.creator_id','F.creator_id',$sQuery);
  446 + }
447 return array($sQuery, $aParams); 447 return array($sQuery, $aParams);
448 } 448 }
449 // {{{ criteriaSetToSQL 449 // {{{ criteriaSetToSQL
@@ -479,15 +479,15 @@ class KTSearchUtil { @@ -479,15 +479,15 @@ class KTSearchUtil {
479 $aValues = KTUtil::arrayGet($aOneCriteriaSet, "values"); 479 $aValues = KTUtil::arrayGet($aOneCriteriaSet, "values");
480 $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup"); 480 $aSubgroup = KTUtil::arrayGet($aOneCriteriaSet, "subgroup");
481 if (!empty($aValues)) { 481 if (!empty($aValues)) {
482 - $res = KTSearchUtil::_oneCriteriaSetToSQL($aOneCriteriaSet["values"]);  
483 - if(PEAR::isError($res)) {  
484 - return $res;  
485 - }  
486 - list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res;  
487 - $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL);  
488 - $aParams = kt_array_merge($aParams, $aThisParams);  
489 - $tabs = str_repeat("\t", ($iRecurseLevel + 2));  
490 - $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)"; 482 + $res = KTSearchUtil::_oneCriteriaSetToSQL($aOneCriteriaSet["values"]);
  483 + if(PEAR::isError($res)) {
  484 + return $res;
  485 + }
  486 + list($aThisCritQueries, $aThisParams, $aThisJoinSQL) = $res;
  487 + $aJoinSQL = kt_array_merge($aJoinSQL, $aThisJoinSQL);
  488 + $aParams = kt_array_merge($aParams, $aThisParams);
  489 + $tabs = str_repeat("\t", ($iRecurseLevel + 2));
  490 + $aSearchStrings[] = "\n$tabs(\n$tabs\t" . join("\n " . KTUtil::arrayGet($aOneCriteriaSet, 'join', "AND") . " ", $aThisCritQueries) . "\n$tabs)";
491 } else if (!empty($aSubgroup)) { 491 } else if (!empty($aSubgroup)) {
492 /* 492 /*
493 * Recurse if we have a criteria set with subgroups. 493 * Recurse if we have a criteria set with subgroups.
@@ -595,15 +595,15 @@ class KTSearchUtil { @@ -595,15 +595,15 @@ class KTSearchUtil {
595 $sInitialJoin = $sInitialJoin[0]; 595 $sInitialJoin = $sInitialJoin[0];
596 } 596 }
597 597
598 - $res = KTSearchUtil::criteriaSetToSQL($aCriteriaSet); 598 + $res = KTSearchUtil::criteriaSetToSQL($aCriteriaSet);
599 599
600 - if(PEAR::isError($res)) return $res; 600 + if(PEAR::isError($res)) return $res;
601 list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res; 601 list($sSQLSearchString, $aCritParams, $sCritJoinSQL) = $res;
602 602
603 $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version. 603 $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); // actually never present in this version.
604 604
605 $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName); 605 $res = KTSearchUtil::permissionToSQL($oUser, $sPermissionName);
606 - 606 +
607 if (PEAR::isError($res)) { // only occurs if the group has no permissions. 607 if (PEAR::isError($res)) { // only occurs if the group has no permissions.
608 return $res; 608 return $res;
609 } else { 609 } else {
@@ -715,8 +715,8 @@ class KTSearchUtil { @@ -715,8 +715,8 @@ class KTSearchUtil {
715 return $cnt > 0; 715 return $cnt > 0;
716 } 716 }
717 // }}} 717 // }}}
718 -  
719 - 718 +
  719 +
720 function testConditionOnFolder($oSearch, $oFolder) { 720 function testConditionOnFolder($oSearch, $oFolder) {
721 $oSearch =& KTUtil::getObject('KTSavedSearch', $oSearch); 721 $oSearch =& KTUtil::getObject('KTSavedSearch', $oSearch);
722 $iFolderId = KTUtil::getId($oFolder); 722 $iFolderId = KTUtil::getId($oFolder);
@@ -741,7 +741,7 @@ function testConditionOnFolder($oSearch, $oFolder) { @@ -741,7 +741,7 @@ function testConditionOnFolder($oSearch, $oFolder) {
741 ), 741 ),
742 ); 742 );
743 $aOptions = array('select' => 'COUNT(DISTINCT(F.id)) AS cnt'); 743 $aOptions = array('select' => 'COUNT(DISTINCT(F.id)) AS cnt');
744 - $aQuery = KTSearchUtil::criteriaToFolderQuery($aCriteriaSet, null, null, $aOptions); 744 + $aQuery = KTSearchUtil::criteriaToFolderQuery($aCriteriaSet, null, null, $aOptions);
745 745
746 746
747 747
@@ -759,8 +759,8 @@ function testConditionOnFolder($oSearch, $oFolder) { @@ -759,8 +759,8 @@ function testConditionOnFolder($oSearch, $oFolder) {
759 if (!is_numeric($cnt)) { 759 if (!is_numeric($cnt)) {
760 return PEAR::raiseError(_kt("Non-integer returned when looking for count")); 760 return PEAR::raiseError(_kt("Non-integer returned when looking for count"));
761 } 761 }
762 - 762 +
763 return $cnt > 0; 763 return $cnt > 0;
764 } 764 }
765 - 765 +
766 } 766 }
767 \ No newline at end of file 767 \ No newline at end of file
lib/widgets/fieldsetDisplay.inc.php
@@ -108,13 +108,13 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null @@ -108,13 +108,13 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null
108 $fieldTree = new MDTree(); 108 $fieldTree = new MDTree();
109 $fieldTree->buildForField($field->getId()); 109 $fieldTree->buildForField($field->getId());
110 $fieldTree->setActiveItem($current_value); 110 $fieldTree->setActiveItem($current_value);
111 - $fieldOptions['tree'] = $fieldTree->_evilTreeRenderer($fieldTree, $fieldName); 111 + $fieldOptions['tree'] = $fieldTree->_evilTreeRenderer($fieldTree, $fieldName);
112 112
113 $oField = new KTTreeWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); 113 $oField = new KTTreeWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
114 } 114 }
115 } else if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && $field->getHasInetLookup()){ 115 } else if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && $field->getHasInetLookup()){
116 - require_once(KT_DIR."/plugins/multiselect/InetWidgets.php");  
117 - if ($vocab === null) { // allow override 116 + require_once(KT_DIR."/plugins/multiselect/InetWidgets.php");
  117 + if ($vocab === null) { // allow override
118 $lookups = MetaData::getEnabledByDocumentField($field); 118 $lookups = MetaData::getEnabledByDocumentField($field);
119 $fieldOptions['vocab'] = array(); // FIXME handle lookups 119 $fieldOptions['vocab'] = array(); // FIXME handle lookups
120 foreach ($lookups as $md) { 120 foreach ($lookups as $md) {
@@ -123,8 +123,8 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null @@ -123,8 +123,8 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null
123 } else { 123 } else {
124 $fieldOptions['vocab'] = $vocab; 124 $fieldOptions['vocab'] = $vocab;
125 } 125 }
126 - $fieldOptions['multi'] = true;  
127 - $fieldOptions['lookup_type'] = $field->getInetLookupType(); 126 + $fieldOptions['multi'] = true;
  127 + $fieldOptions['lookup_type'] = $field->getInetLookupType();
128 $oField = new InetMultiselectWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); 128 $oField = new InetMultiselectWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
129 } else { 129 } else {
130 $oField = new KTBaseWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions); 130 $oField = new KTBaseWidget($fieldLabel, $fieldDescription, $fieldName, $fieldValue, $page, $fieldRequired, null, $fieldErrors, $fieldOptions);
@@ -184,8 +184,8 @@ class KTFieldsetDisplay { @@ -184,8 +184,8 @@ class KTFieldsetDisplay {
184 if (!empty($res['friendly_name'])) { 184 if (!empty($res['friendly_name'])) {
185 return _kt($res['friendly_name']); 185 return _kt($res['friendly_name']);
186 } else { 186 } else {
187 - return sprintf(_kt('%s File'), strtoupper($res['filetypes']));  
188 - } 187 + return sprintf(_kt('%s File'), strtoupper($res['filetypes']));
  188 + }
189 189
190 } 190 }
191 191
@@ -261,7 +261,7 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay { @@ -261,7 +261,7 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
261 'document_data' => $aDocumentData, 261 'document_data' => $aDocumentData,
262 'document' => $aDocumentData['document'], 262 'document' => $aDocumentData['document'],
263 263
264 - 'filename' => $document->getFileName(), 264 + 'filename' => $document->getFileName(),
265 265
266 'creator' => $creator_name, 266 'creator' => $creator_name,
267 'owner' => $owner_name, 267 'owner' => $owner_name,
@@ -337,11 +337,11 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay { @@ -337,11 +337,11 @@ class GenericFieldsetDisplay extends KTFieldsetDisplay {
337 'document_data' => $aDocumentData, 337 'document_data' => $aDocumentData,
338 'document' => $aDocumentData['document'], 338 'document' => $aDocumentData['document'],
339 339
340 - 'title' => $document->getName(),  
341 - 'comparison_title' => $comparison_document->getName(), 340 + 'title' => $document->getName(),
  341 + 'comparison_title' => $comparison_document->getName(),
342 342
343 - 'filename' => $document->getFileName(),  
344 - 'comparison_filename' => $comparison_document->getFileName(), 343 + 'filename' => $document->getFileName(),
  344 + 'comparison_filename' => $comparison_document->getFileName(),
345 345
346 'creator' => $creator, 346 'creator' => $creator,
347 'creation_date' => $creation_date, 347 'creation_date' => $creation_date,
@@ -424,7 +424,7 @@ class SimpleFieldsetDisplay extends KTFieldsetDisplay { @@ -424,7 +424,7 @@ class SimpleFieldsetDisplay extends KTFieldsetDisplay {
424 'document' => $aDocumentData['document'], 424 'document' => $aDocumentData['document'],
425 'fieldset' => $this->fieldset, 425 'fieldset' => $this->fieldset,
426 'fieldset_values' => $fieldset_values, 426 'fieldset_values' => $fieldset_values,
427 - 'description' => $this->fieldset->getDescription(), 427 + 'description' => $this->fieldset->getDescription(),
428 ); 428 );
429 return $oTemplate->render($aTemplateData); 429 return $oTemplate->render($aTemplateData);
430 } 430 }
@@ -533,25 +533,25 @@ class ConditionalFieldsetDisplay extends SimpleFieldsetDisplay { @@ -533,25 +533,25 @@ class ConditionalFieldsetDisplay extends SimpleFieldsetDisplay {
533 // how? 533 // how?
534 534
535 $fieldset_name = $this->fieldset->getName(); 535 $fieldset_name = $this->fieldset->getName();
536 - $fieldset_description = _kt($this->fieldset->getDescription()); // need a better approach. how do we handle database-resident translations? 536 + $fieldset_description = _kt($this->fieldset->getDescription()); // need a better approach. how do we handle database-resident translations?
537 $fieldset_description .= _kt('Note that the options which are available depends on previous choices within this fieldset.'); 537 $fieldset_description .= _kt('Note that the options which are available depends on previous choices within this fieldset.');
538 538
539 // FIXME handle the editable case _with_ values. 539 // FIXME handle the editable case _with_ values.
540 540
541 if ($have_values) { 541 if ($have_values) {
542 - $oTemplating =& KTTemplating::getSingleton();  
543 - $oTemplate = $oTemplating->loadTemplate('kt3/fieldsets/conditional_editable_values');  
544 - $aTemplateData = array(  
545 - 'context' => $this,  
546 - 'fields' => $fields =& $this->fieldset->getFields(),  
547 - 'fieldset_id' => $this->fieldset->getId(),  
548 - 'title' => $fieldset_name,  
549 - 'description' => $fieldset_description,  
550 - 'values' => $values, 542 + $oTemplating =& KTTemplating::getSingleton();
  543 + $oTemplate = $oTemplating->loadTemplate('kt3/fieldsets/conditional_editable_values');
  544 + $aTemplateData = array(
  545 + 'context' => $this,
  546 + 'fields' => $fields =& $this->fieldset->getFields(),
  547 + 'fieldset_id' => $this->fieldset->getId(),
  548 + 'title' => $fieldset_name,
  549 + 'description' => $fieldset_description,
  550 + 'values' => $values,
551 'errors' => $errors, 551 'errors' => $errors,
552 - ); 552 + );
553 553
554 - return $oTemplate->render($aTemplateData); 554 + return $oTemplate->render($aTemplateData);
555 } // else { 555 } // else {
556 556
557 $oTemplating =& KTTemplating::getSingleton(); 557 $oTemplating =& KTTemplating::getSingleton();
plugins/ktcore/document/edit.php
@@ -219,17 +219,17 @@ class KTDocumentEditAction extends KTDocumentAction { @@ -219,17 +219,17 @@ class KTDocumentEditAction extends KTDocumentAction {
219 219
220 if($oField->getDataType() == "LARGE TEXT") 220 if($oField->getDataType() == "LARGE TEXT")
221 { 221 {
222 - if(strlen(strip_tags($val)) > $oField->getMaxLength())  
223 - {  
224 - $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))));  
225 - } 222 + if(strlen(strip_tags($val)) > $oField->getMaxLength())
  223 + {
  224 + $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))));
  225 + }
226 } 226 }
227 227
228 // FIXME "null" has strange meanings here. 228 // FIXME "null" has strange meanings here.
229 if (!is_null($val)) { 229 if (!is_null($val)) {
230 if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && is_array($val) && $oField->getHasInetLookup()) { 230 if(KTPluginUtil::pluginIsActive('inet.multiselect.lookupvalue.plugin') && is_array($val) && $oField->getHasInetLookup()) {
231 - $val = join(", ",$val);  
232 - } 231 + $val = join(", ",$val);
  232 + }
233 $MDPack[] = array( 233 $MDPack[] = array(
234 $oField, 234 $oField,
235 $val 235 $val
plugins/multiselect/BulkImport.php
@@ -64,7 +64,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction { @@ -64,7 +64,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction {
64 { 64 {
65 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>"; 65 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>";
66 $js .= "<script src='plugins/multiselect/js/hidelink.js' type='text/javascript'></script>"; 66 $js .= "<script src='plugins/multiselect/js/hidelink.js' type='text/javascript'></script>";
67 - return $js._kt('Import from Server Location(RATP)'); 67 + return $js._kt('Import from Server Location');
68 } 68 }
69 else 69 else
70 { 70 {
plugins/multiselect/BulkUpload.php
@@ -63,7 +63,7 @@ class InetBulkUploadFolderAction extends KTFolderAction { @@ -63,7 +63,7 @@ class InetBulkUploadFolderAction extends KTFolderAction {
63 { 63 {
64 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>"; 64 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>";
65 $js .= "<script src='plugins/multiselect/js/hidelink.js' type='text/javascript'></script>"; 65 $js .= "<script src='plugins/multiselect/js/hidelink.js' type='text/javascript'></script>";
66 - return $js._kt('Bulk Upload (RATP)'); 66 + return $js._kt('Bulk Upload');
67 } 67 }
68 else 68 else
69 { 69 {
plugins/multiselect/MultiSelectPlugin.php
@@ -52,7 +52,7 @@ class MultiSelectPlugin extends KTPlugin { @@ -52,7 +52,7 @@ class MultiSelectPlugin extends KTPlugin {
52 */ 52 */
53 function MultiSelectPlugin($sFilename = null) { 53 function MultiSelectPlugin($sFilename = null) {
54 $res = parent::KTPlugin($sFilename); 54 $res = parent::KTPlugin($sFilename);
55 - $this->sFriendlyName = _kt('Permits multiselect or single select choices.'); 55 + $this->sFriendlyName = _kt('Multi-select Plugin');
56 return $res; 56 return $res;
57 } 57 }
58 58
@@ -62,7 +62,7 @@ class MultiSelectPlugin extends KTPlugin { @@ -62,7 +62,7 @@ class MultiSelectPlugin extends KTPlugin {
62 */ 62 */
63 function setup() { 63 function setup() {
64 $oTemplating =& KTTemplating::getSingleton(); 64 $oTemplating =& KTTemplating::getSingleton();
65 - $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates'); 65 + $oTemplating->addLocation('Multiselect in metadata Part {lookup Value}', '/plugins/multiselect/templates');
66 66
67 $dir = dirname(__FILE__); 67 $dir = dirname(__FILE__);
68 $this->applySQL(realpath($dir . '/sql/script.sql')); 68 $this->applySQL(realpath($dir . '/sql/script.sql'));
@@ -116,7 +116,7 @@ class MultiSelectPlugin extends KTPlugin { @@ -116,7 +116,7 @@ class MultiSelectPlugin extends KTPlugin {
116 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>"; 116 $js = "<script src='plugins/multiselect/js/jquery-1.2.6.js' type='text/javascript'></script>";
117 $js .= "<script src='plugins/multiselect/js/hideadminlink.js' type='text/javascript'></script>"; 117 $js .= "<script src='plugins/multiselect/js/hideadminlink.js' type='text/javascript'></script>";
118 $this->registerAdminPage('ratpfieldset', 'InetDocumentFieldDispatcher', 'documents', 118 $this->registerAdminPage('ratpfieldset', 'InetDocumentFieldDispatcher', 'documents',
119 - $js._kt('Document Fieldsets (RATP)'), 119 + $js._kt('Document Fieldsets'),
120 _kt('Manage the different types of information with multiselect functionality that can be associated with classes of documents.'), 120 _kt('Manage the different types of information with multiselect functionality that can be associated with classes of documents.'),
121 'InetdocumentFieldsv2.php', null); 121 'InetdocumentFieldsv2.php', null);
122 } 122 }
plugins/multiselect/inetbasic.inc.php
@@ -107,7 +107,7 @@ class InetBasicFieldsetManagementDispatcher extends KTAdminDispatcher { @@ -107,7 +107,7 @@ class InetBasicFieldsetManagementDispatcher extends KTAdminDispatcher {
107 'normal' => _kt("Normal (String)"), 107 'normal' => _kt("Normal (String)"),
108 'lookup' => _kt("Lookup"), 108 'lookup' => _kt("Lookup"),
109 'tree' => _kt("Tree"), 109 'tree' => _kt("Tree"),
110 - 'Multiselect' => _kt("Multiselect (RATP)"), 110 + 'Multiselect' => _kt("Multiselect"),
111 ); 111 );
112 return $types; 112 return $types;
113 } 113 }