Commit f6212be35eadfa13c9bcf76107701a38c6117fc4

Authored by conradverm
1 parent 4d9faaef

KTS-1694

"SOAP Webservice Implementation"
Updated. Updated some things for consistency.

Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6484 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 27 additions and 16 deletions
ktwsapi/php/ktwsapi.inc.php
... ... @@ -42,6 +42,8 @@ class KTWSAPI_FolderItem
42 42 {
43 43 var $ktapi;
44 44  
  45 + var $parent_id;
  46 +
45 47 /**
46 48 * Upload a file to KT. Returns a temp filename on the server.
47 49 *
... ... @@ -157,14 +159,24 @@ class KTWSAPI_FolderItem
157 159 return $response;
158 160 }
159 161  
  162 + /**
  163 + * Returns a reference to the parent folder.
  164 + *
  165 + * @return KTWSAPI_Folder
  166 + */
  167 + function &get_parent_folder()
  168 + {
  169 + $parent = &KTAPI::get_folder_by_id($this->parent_id);
  170 + return $parent;
  171 + }
  172 +
160 173 }
161 174  
162 175 class KTWSAPI_Folder extends KTWSAPI_FolderItem
163 176 {
164 177 var $folder_name;
165   - var $parent_id;
166 178 var $full_path;
167   - var $folderid;
  179 + var $folder_id;
168 180  
169 181 /**
170 182 * Constructor
... ... @@ -176,7 +188,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
176 188 function KTWSAPI_Folder(&$ktapi, $kt_folder_detail)
177 189 {
178 190 $this->ktapi = &$ktapi;
179   - $this->folderid = $kt_folder_detail->id+0;
  191 + $this->folder_id = $kt_folder_detail->id+0;
180 192 $this->folder_name = $kt_folder_detail->folder_name;
181 193 $this->parent_id = $kt_folder_detail->parent_id+0;
182 194 $this->full_path = $kt_folder_detail->full_path;
... ... @@ -240,7 +252,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
240 252 */
241 253 function get_folderid()
242 254 {
243   - return $this->folderid;
  255 + return $this->folder_id;
244 256 }
245 257  
246 258 /**
... ... @@ -296,7 +308,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
296 308 */
297 309 function get_listing($depth=1, $what='DF')
298 310 {
299   - $kt_folder_contents = $this->ktapi->soapclient->get_folder_contents($this->ktapi->session, $this->folderid, $depth+0, $what);
  311 + $kt_folder_contents = $this->ktapi->soapclient->get_folder_contents($this->ktapi->session, $this->folder_id, $depth+0, $what);
300 312 if (SOAP_Client::isError($kt_folder_contents))
301 313 {
302 314 return $kt_folder_contents;
... ... @@ -388,7 +400,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
388 400 */
389 401 function &add_folder($foldername)
390 402 {
391   - $kt_folder_detail = $this->ktapi->soapclient->create_folder($this->ktapi->session, $this->folderid, $foldername);
  403 + $kt_folder_detail = $this->ktapi->soapclient->create_folder($this->ktapi->session, $this->folder_id, $foldername);
392 404 if (SOAP_Client::isError($kt_folder_detail))
393 405 {
394 406 return $kt_folder_detail;
... ... @@ -413,7 +425,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
413 425 function delete($reason)
414 426 {
415 427 // TODO: check why no transaction in folder_transactions
416   - $kt_response = $this->ktapi->soapclient->delete_folder($this->ktapi->session, $this->folderid, $reason);
  428 + $kt_response = $this->ktapi->soapclient->delete_folder($this->ktapi->session, $this->folder_id, $reason);
417 429 if (SOAP_Client::isError($kt_response))
418 430 {
419 431 return $kt_response;
... ... @@ -435,7 +447,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
435 447 */
436 448 function rename($newname)
437 449 {
438   - $kt_response = $this->ktapi->soapclient->rename_folder($this->ktapi->session, $this->folderid, $newname);
  450 + $kt_response = $this->ktapi->soapclient->rename_folder($this->ktapi->session, $this->folder_id, $newname);
439 451 if (SOAP_Client::isError($kt_response))
440 452 {
441 453 return $kt_response;
... ... @@ -461,7 +473,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
461 473 assert(!is_null($ktwsapi_target_folder));
462 474 assert(is_a($ktwsapi_target_folder,'KTWSAPI_Folder'));
463 475  
464   - $kt_response = $this->ktapi->soapclient->move_folder($this->ktapi->session, $this->folderid,$ktwsapi_target_folder->get_folderid(), $newname);
  476 + $kt_response = $this->ktapi->soapclient->move_folder($this->ktapi->session, $this->folder_id,$ktwsapi_target_folder->get_folderid(), $newname);
465 477 if (SOAP_Client::isError($kt_response))
466 478 {
467 479 return $kt_response;
... ... @@ -489,7 +501,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
489 501  
490 502 $targetid=$ktwsapi_target_folder->get_folderid();
491 503  
492   - $kt_response = $this->ktapi->soapclient->copy_folder($this->ktapi->session, $this->folderid,$targetid, $reason);
  504 + $kt_response = $this->ktapi->soapclient->copy_folder($this->ktapi->session, $this->folder_id,$targetid, $reason);
493 505 if (SOAP_Client::isError($kt_response))
494 506 {
495 507 return $kt_response;
... ... @@ -532,7 +544,7 @@ class KTWSAPI_Folder extends KTWSAPI_FolderItem
532 544 }
533 545  
534 546 // Second step - move file into KT
535   - $kt_document_detail = $this->ktapi->soapclient->add_document($this->ktapi->session, $this->folderid, $title, $basename, $documenttype, $tempfilename );
  547 + $kt_document_detail = $this->ktapi->soapclient->add_document($this->ktapi->session, $this->folder_id, $title, $basename, $documenttype, $tempfilename );
536 548 if (SOAP_Client::isError($kt_document_detail))
537 549 {
538 550 return $kt_document_detail;
... ... @@ -559,7 +571,6 @@ class KTWSAPI_Document extends KTWSAPI_FolderItem
559 571 var $created_by;
560 572 var $updated_date;
561 573 var $updated_by;
562   - var $folder_id;
563 574 var $workflow;
564 575 var $workflow_state;
565 576 var $checkout_by;
... ... @@ -584,7 +595,7 @@ class KTWSAPI_Document extends KTWSAPI_FolderItem
584 595 $this->created_by = $kt_document_detail->created_by;
585 596 $this->updated_date = $kt_document_detail->updated_date;
586 597 $this->updated_by = $kt_document_detail->updated_by;
587   - $this->folder_id = $kt_document_detail->folder_id;
  598 + $this->parent_id = $kt_document_detail->folder_id;
588 599 $this->workflow = $kt_document_detail->workflow;
589 600 $this->workflow_state = $kt_document_detail->workflow_state;
590 601 $this->checkout_by = $kt_document_detail->checkout_by;
... ... @@ -968,7 +979,7 @@ class KTWSAPI_Document extends KTWSAPI_FolderItem
968 979 *
969 980 * @return true
970 981 */
971   - function delete_document_workflow()
  982 + function delete_workflow()
972 983 {
973 984 $kt_response = $this->ktapi->soapclient->delete_document_workflow($this->ktapi->session, $this->document_id);
974 985 if (SOAP_Client::isError($kt_response))
... ... @@ -991,7 +1002,7 @@ class KTWSAPI_Document extends KTWSAPI_FolderItem
991 1002 * @param string $reason
992 1003 * @return true
993 1004 */
994   - function perform_document_workflow_transition($transition,$reason)
  1005 + function perform_workflow_transition($transition,$reason)
995 1006 {
996 1007 $kt_response = $this->ktapi->soapclient->delete_document_workflow($this->ktapi->session, $this->document_id, $transition, $reason);
997 1008 if (SOAP_Client::isError($kt_response))
... ... @@ -1113,7 +1124,7 @@ class KTWSAPI
1113 1124 * @param int $timeout
1114 1125 * @return KTWSAPI
1115 1126 */
1116   - function KTWSAPI($wsdl, $timeout=30)
  1127 + function KTWSAPI($wsdl = KTWebService_WSDL, $timeout=30)
1117 1128 {
1118 1129 $this->wsdl = new SOAP_WSDL($wsdl);
1119 1130 $this->timeout = $timeout;
... ...