diff --git a/config/config.ini b/config/config.ini index 1792063..7d288ca 100644 --- a/config/config.ini +++ b/config/config.ini @@ -291,7 +291,7 @@ safemode = on ; Identify the location of the mysql.exe and mysqldump.exe ;mysqlDirectory=c:/program files/ktdms/mysql/bin -[KTtoolsSettings] +[clientToolPolicies] ;These two settings control whether or not the client is prompted for metadata when a ;document is added to knowledgetree via KTtools. They default to true. explorerMetadataCapture = true diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php index c23246f..7ca0bfb 100644 --- a/config/dmsDefaults.php +++ b/config/dmsDefaults.php @@ -451,8 +451,8 @@ class KTInit { $oKTConfig->setdefaultns('webservice', 'downloadExpiry', '30'); $oKTConfig->setdefaultns('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu'); - $oKTConfig->setdefaultns('KTtoolsSettings', 'explorerMetadataCapture', true); - $oKTConfig->setdefaultns('KTtoolsSettings', 'officeMetadataCapture', true); + $oKTConfig->setdefaultns('clientToolPolicies', 'explorerMetadataCapture', true); + $oKTConfig->setdefaultns('clientToolPolicies', 'officeMetadataCapture', true); $res = $this->readConfig(); diff --git a/ktapi/ktapi.inc.php b/ktapi/ktapi.inc.php index 5e45189..3e3dc9f 100644 --- a/ktapi/ktapi.inc.php +++ b/ktapi/ktapi.inc.php @@ -576,11 +576,6 @@ class KTAPI return $results; } - function get_dms_defaults() - { - global $default; - return $default; - } } diff --git a/ktwebservice/webservice.php b/ktwebservice/webservice.php index 7860508..08fda11 100644 --- a/ktwebservice/webservice.php +++ b/ktwebservice/webservice.php @@ -57,6 +57,21 @@ define('KTWS_ERR_INVALID_DEPTH', 25); define('KTWS_ERR_PROBLEM', 98); define('KTWS_ERR_DB_PROBLEM', 99); + + function bool2str($bool) + { + if (is_bool($bool)) + { + return $bool?'true':'false'; + } + if (is_numeric($bool)) + { + return ($bool+0)?'true':'false'; + } + // assume str + return (strtolower($bool) == 'true')?'true':'false'; + } + class KTWebService { /** @@ -323,17 +338,26 @@ class KTWebService 'document_types' => "{urn:$this->namespace}kt_document_types_array" ); - $this->__typedef["{urn:$this->namespace}kt_server_settings"] = + $this->__typedef["{urn:$this->namespace}kt_client_policy"] = + array( + 'name' => 'string', + 'value' => 'string', + 'type' => 'string', + ); + + $this->__typedef["{urn:$this->namespace}kt_client_policies_array"] = array( - 'explorer_metadata_capture' => 'boolean', - 'office_metadata_capture' => 'boolean' - ); + array( + 'policies' => "{urn:$this->namespace}kt_client_policy" + ) + ); + - $this->__typedef["{urn:$this->namespace}kt_server_settings_response"] = + $this->__typedef["{urn:$this->namespace}kt_client_policies_response"] = array( 'status_code' => 'int', 'message' => 'string', - 'settings' => "{urn:$this->namespace}kt_server_settings" + 'policies' => "{urn:$this->namespace}kt_client_policies_array" ); /* methods */ @@ -635,10 +659,10 @@ class KTWebService 'out' => array( 'return' => "{urn:$this->namespace}kt_document_types_response" ), ); - // get_server_settings - $this->__dispatch_map['get_server_settings'] = + // get_client_policies + $this->__dispatch_map['get_client_policies'] = array('in' => array('session_id'=>'string' ), - 'out' => array( 'return' => "{urn:$this->namespace}kt_server_settings_response" ), + 'out' => array( 'return' => "{urn:$this->namespace}kt_client_policies_response" ), ); @@ -2974,29 +2998,49 @@ class KTWebService return $response; } + function _encode_client_policies($policies) + { + $encoded=array(); + foreach($policies as $policy) + { + $encoded[] = new SOAP_Value('policy',"{urn:$this->namespace}kt_client_policy", $policy); + } + if (empty($encoded)) + { + $encoded=null; + } + return new SOAP_Value('policies',"{urn:$this->namespace}kt_client_policies_array", $encoded); + } + /** - * Retrieves the server settings for this server + * Retrieves the server policies for this server * * @param string $session_id - * @return kt_server_settings_response + * @return kt_client_policies_response */ - function get_server_settings($session_id) + function get_client_policies($session_id) { - $kt = &$this->get_ktapi($session_id ); - if (is_array($kt)) - { - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); - } + $config = KTConfig::getSingleton(); - $dms_defaults = $kt->get_dms_defaults(); - $response['settings'] = array( - 'explorer_metadata_capture' => $dms_defaults->explorerMetadataCapture, - 'office_metadata_capture' => $dms_defaults->officeMetadataCapture - ); - $response['message'] = 'Knowledgetree server settings retrieval succeeded.'; + $policies = array( + array( + 'name' => 'explorer_metadata_capture', + 'value' => bool2str($config->get('clientToolPolicies/explorerMetadataCapture')), + 'type' => 'boolean' + ), + array( + 'name' => 'office_metadata_capture', + 'value' => bool2str($config->get('clientToolPolicies/officeMetadataCapture')), + 'type' => 'boolean' + ), + ); + + + $response['policies'] = $this->_encode_client_policies($policies); + $response['message'] = 'Knowledgetree client policies retrieval succeeded.'; $response['status_code'] = KTWS_SUCCESS; - return $response; + return new SOAP_Value('return',"{urn:$this->namespace}kt_client_policies_response", $response); } /**