Commit 2322912efe5afb7ff7b02d8ea7cae905e8b32245

Authored by ikabot-com
1 parent 1b09cee0

BBS-1036

"Option to turn off request for metadata on document upload"
Changed the architecture of the mechanism to retrieve settings from the server.

Committed By: Isaac Lundall
Reviewed By: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7112 c91229c3-7414-0410-bfa2-8a42b809f60b
config/config.ini
... ... @@ -291,7 +291,7 @@ safemode = on
291 291 ; Identify the location of the mysql.exe and mysqldump.exe
292 292 ;mysqlDirectory=c:/program files/ktdms/mysql/bin
293 293  
294   -[KTtoolsSettings]
  294 +[clientToolPolicies]
295 295 ;These two settings control whether or not the client is prompted for metadata when a
296 296 ;document is added to knowledgetree via KTtools. They default to true.
297 297 explorerMetadataCapture = true
... ...
config/dmsDefaults.php
... ... @@ -451,8 +451,8 @@ class KTInit {
451 451 $oKTConfig->setdefaultns('webservice', 'downloadExpiry', '30');
452 452 $oKTConfig->setdefaultns('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu');
453 453  
454   - $oKTConfig->setdefaultns('KTtoolsSettings', 'explorerMetadataCapture', true);
455   - $oKTConfig->setdefaultns('KTtoolsSettings', 'officeMetadataCapture', true);
  454 + $oKTConfig->setdefaultns('clientToolPolicies', 'explorerMetadataCapture', true);
  455 + $oKTConfig->setdefaultns('clientToolPolicies', 'officeMetadataCapture', true);
456 456  
457 457  
458 458 $res = $this->readConfig();
... ...
ktapi/ktapi.inc.php
... ... @@ -576,11 +576,6 @@ class KTAPI
576 576 return $results;
577 577 }
578 578  
579   - function get_dms_defaults()
580   - {
581   - global $default;
582   - return $default;
583   - }
584 579  
585 580 }
586 581  
... ...
ktwebservice/webservice.php
... ... @@ -323,17 +323,26 @@ class KTWebService
323 323 'document_types' => "{urn:$this->namespace}kt_document_types_array"
324 324 );
325 325  
326   - $this->__typedef["{urn:$this->namespace}kt_server_settings"] =
  326 + $this->__typedef["{urn:$this->namespace}kt_client_policy"] =
  327 + array(
  328 + 'name' => 'string',
  329 + 'value' => 'string',
  330 + 'type' => 'string',
  331 + );
  332 +
  333 + $this->__typedef["{urn:$this->namespace}kt_client_policies_array"] =
327 334 array(
328   - 'explorer_metadata_capture' => 'boolean',
329   - 'office_metadata_capture' => 'boolean'
330   - );
  335 + array(
  336 + 'policies' => "{urn:$this->namespace}kt_client_policy"
  337 + )
  338 + );
  339 +
331 340  
332   - $this->__typedef["{urn:$this->namespace}kt_server_settings_response"] =
  341 + $this->__typedef["{urn:$this->namespace}kt_client_policies_response"] =
333 342 array(
334 343 'status_code' => 'int',
335 344 'message' => 'string',
336   - 'settings' => "{urn:$this->namespace}kt_server_settings"
  345 + 'policies' => "{urn:$this->namespace}kt_client_policies_array"
337 346 );
338 347  
339 348 /* methods */
... ... @@ -635,10 +644,10 @@ class KTWebService
635 644 'out' => array( 'return' => "{urn:$this->namespace}kt_document_types_response" ),
636 645 );
637 646  
638   - // get_server_settings
639   - $this->__dispatch_map['get_server_settings'] =
  647 + // get_client_policies
  648 + $this->__dispatch_map['get_client_policies'] =
640 649 array('in' => array('session_id'=>'string' ),
641   - 'out' => array( 'return' => "{urn:$this->namespace}kt_server_settings_response" ),
  650 + 'out' => array( 'return' => "{urn:$this->namespace}kt_client_policies_response" ),
642 651 );
643 652  
644 653  
... ... @@ -2974,29 +2983,49 @@ class KTWebService
2974 2983 return $response;
2975 2984 }
2976 2985  
  2986 + function _encode_client_policies($policies)
  2987 + {
  2988 + $encoded=array();
  2989 + foreach($policies as $policy)
  2990 + {
  2991 + $encoded[] = new SOAP_Value('policy',"{urn:$this->namespace}kt_client_policy", $policy);
  2992 + }
  2993 + if (empty($encoded))
  2994 + {
  2995 + $encoded=null;
  2996 + }
  2997 + return new SOAP_Value('policies',"{urn:$this->namespace}kt_client_policies_array", $encoded);
  2998 + }
  2999 +
2977 3000 /**
2978   - * Retrieves the server settings for this server
  3001 + * Retrieves the server policies for this server
2979 3002 *
2980 3003 * @param string $session_id
2981   - * @return kt_server_settings_response
  3004 + * @return kt_client_policies_response
2982 3005 */
2983   - function get_server_settings($session_id)
  3006 + function get_client_policies($session_id)
2984 3007 {
2985   - $kt = &$this->get_ktapi($session_id );
2986   - if (is_array($kt))
2987   - {
2988   - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt);
2989   - }
  3008 + $config = KTConfig::getSingleton();
  3009 +
  3010 + $policies = array(
  3011 + array(
  3012 + 'name'=>'explorer_metadata_capture',
  3013 + 'value'=>strtolower((string) $config->get('clientToolPolicies/explorerMetadataCapture')),
  3014 + 'type'=>'boolean'
  3015 + ),
  3016 + array(
  3017 + 'name'=>'office_metadata_capture',
  3018 + 'value'=>strtolower((string) $config->get('clientToolPolicies/officeMetadataCapture')),
  3019 + 'type'=>'boolean'
  3020 + ),
  3021 + );
2990 3022  
2991   - $dms_defaults = $kt->get_dms_defaults();
2992   - $response['settings'] = array(
2993   - 'explorer_metadata_capture' => $dms_defaults->explorerMetadataCapture,
2994   - 'office_metadata_capture' => $dms_defaults->officeMetadataCapture
2995   - );
2996   - $response['message'] = 'Knowledgetree server settings retrieval succeeded.';
  3023 +
  3024 + $response['policies'] = $this->_encode_client_policies($policies);
  3025 + $response['message'] = 'Knowledgetree client policies retrieval succeeded.';
2997 3026 $response['status_code'] = KTWS_SUCCESS;
2998 3027  
2999   - return $response;
  3028 + return new SOAP_Value('return',"{urn:$this->namespace}kt_client_policies_response", $response);
3000 3029 }
3001 3030  
3002 3031 /**
... ...