Commit 9bd4a5319e0a7b3001a35e25874098b1630d138b

Authored by Tohir Solomons
1 parent f3dd0f05

Replaced default control type of 'string' with correct one.

Add options per control type
Updated WSDL

Committed by: Tohir Solomons
Reviewed by: Megan Watson
ktapi/KTAPIDocument.inc.php
@@ -1238,7 +1238,11 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1238,7 +1238,11 @@ class KTAPI_Document extends KTAPI_FolderItem
1238 $value = $fieldvalue->getValue(); 1238 $value = $fieldvalue->getValue();
1239 } 1239 }
1240 1240
1241 - $controltype = 'string'; 1241 + // Old
  1242 + //$controltype = 'string';
  1243 + // Replace with true
  1244 + $controltype = strtolower($field->getDataType());
  1245 +
1242 if ($field->getHasLookup()) 1246 if ($field->getHasLookup())
1243 { 1247 {
1244 $controltype = 'lookup'; 1248 $controltype = 'lookup';
@@ -1247,7 +1251,10 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1247,7 +1251,10 @@ class KTAPI_Document extends KTAPI_FolderItem
1247 $controltype = 'tree'; 1251 $controltype = 'tree';
1248 } 1252 }
1249 } 1253 }
1250 - 1254 +
  1255 + // Options - Required for Custom Properties
  1256 + $options = array();
  1257 +
1251 switch ($controltype) 1258 switch ($controltype)
1252 { 1259 {
1253 case 'lookup': 1260 case 'lookup':
@@ -1256,6 +1263,13 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1256,6 +1263,13 @@ class KTAPI_Document extends KTAPI_FolderItem
1256 case 'tree': 1263 case 'tree':
1257 $selection = KTAPI::get_metadata_tree($field->getId()); 1264 $selection = KTAPI::get_metadata_tree($field->getId());
1258 break; 1265 break;
  1266 + case 'large text':
  1267 + $options = array(
  1268 + 'ishtml' => $field->getIsHTML(),
  1269 + 'maxlength' => $field->getMaxLength()
  1270 + );
  1271 + $selection= array();
  1272 + break;
1259 default: 1273 default:
1260 $selection= array(); 1274 $selection= array();
1261 } 1275 }
@@ -1268,7 +1282,8 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1268,7 +1282,8 @@ class KTAPI_Document extends KTAPI_FolderItem
1268 'blankvalue' => $value=='' ? '1' : '0', 1282 'blankvalue' => $value=='' ? '1' : '0',
1269 'description' => $field->getDescription(), 1283 'description' => $field->getDescription(),
1270 'control_type' => $controltype, 1284 'control_type' => $controltype,
1271 - 'selection' => $selection 1285 + 'selection' => $selection,
  1286 + 'options' => $options,
1272 1287
1273 ); 1288 );
1274 1289
ktapi/ktapi.inc.php
@@ -1024,7 +1024,10 @@ class KTAPI @@ -1024,7 +1024,10 @@ class KTAPI
1024 $value = 'n/a'; 1024 $value = 'n/a';
1025 1025
1026 1026
1027 - $controltype = 'string'; 1027 + //$controltype = 'string';
  1028 +
  1029 + // Replace with true
  1030 + $controltype = strtolower($field->getDataType());
1028 if ($field->getHasLookup()) 1031 if ($field->getHasLookup())
1029 { 1032 {
1030 $controltype = 'lookup'; 1033 $controltype = 'lookup';
@@ -1033,7 +1036,8 @@ class KTAPI @@ -1033,7 +1036,8 @@ class KTAPI
1033 $controltype = 'tree'; 1036 $controltype = 'tree';
1034 } 1037 }
1035 } 1038 }
1036 - 1039 +
  1040 + $options = array();
1037 switch ($controltype) 1041 switch ($controltype)
1038 { 1042 {
1039 case 'lookup': 1043 case 'lookup':
@@ -1042,6 +1046,13 @@ class KTAPI @@ -1042,6 +1046,13 @@ class KTAPI
1042 case 'tree': 1046 case 'tree':
1043 $selection = KTAPI::get_metadata_tree($field->getId()); 1047 $selection = KTAPI::get_metadata_tree($field->getId());
1044 break; 1048 break;
  1049 + case 'large text':
  1050 + $options = array(
  1051 + 'ishtml' => $field->getIsHTML(),
  1052 + 'maxlength' => $field->getMaxLength()
  1053 + );
  1054 + $selection= array();
  1055 + break;
1045 default: 1056 default:
1046 $selection= array(); 1057 $selection= array();
1047 } 1058 }
@@ -1053,7 +1064,8 @@ class KTAPI @@ -1053,7 +1064,8 @@ class KTAPI
1053 'value' => $value, 1064 'value' => $value,
1054 'description' => $field->getDescription(), 1065 'description' => $field->getDescription(),
1055 'control_type' => $controltype, 1066 'control_type' => $controltype,
1056 - 'selection' => $selection 1067 + 'selection' => $selection,
  1068 + 'options' => $options,
1057 ); 1069 );
1058 } 1070 }
1059 $result['fields'] = $fieldsresult; 1071 $result['fields'] = $fieldsresult;
ktwebservice/webservice.php
@@ -435,6 +435,12 @@ class KTWebService @@ -435,6 +435,12 @@ class KTWebService
435 'item' => "{urn:$this->namespace}kt_metadata_selection_item" 435 'item' => "{urn:$this->namespace}kt_metadata_selection_item"
436 ) 436 )
437 ); 437 );
  438 +
  439 + $this->__typedef["{urn:$this->namespace}kt_metadata_options"] =
  440 + array(
  441 + 'ishtml' => 'string',
  442 + 'maxlength' => 'string'
  443 + );
438 444
439 $this->__typedef["{urn:$this->namespace}kt_metadata_field"] = 445 $this->__typedef["{urn:$this->namespace}kt_metadata_field"] =
440 array( 446 array(
@@ -443,7 +449,8 @@ class KTWebService @@ -443,7 +449,8 @@ class KTWebService
443 'value' => 'string' , 449 'value' => 'string' ,
444 'description' => 'string' , 450 'description' => 'string' ,
445 'control_type' => 'string' , 451 'control_type' => 'string' ,
446 - 'selection' => "{urn:$this->namespace}kt_metadata_selection" 452 + 'selection' => "{urn:$this->namespace}kt_metadata_selection",
  453 + 'options' => "{urn:$this->namespace}kt_metadata_options"
447 ); 454 );
448 455
449 $this->__typedef["{urn:$this->namespace}kt_metadata_fields"] = 456 $this->__typedef["{urn:$this->namespace}kt_metadata_fields"] =