Commit 2cbb04a11b21fa996697cef251656a661340e905
1 parent
44f7655f
WSA-49
"Improve the document_detail and folder_detail records to incorporate more fields available on the document" Updated. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7762 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
141 additions
and
241 deletions
ktwebservice/webservice.php
| ... | ... | @@ -182,6 +182,9 @@ class KTWebService |
| 182 | 182 | 'id' => 'int', |
| 183 | 183 | 'item_type' => 'string', |
| 184 | 184 | |
| 185 | + 'custom_document_no' => 'string', | |
| 186 | + 'oem_document_no' => 'string', | |
| 187 | + | |
| 185 | 188 | 'title' => 'string', |
| 186 | 189 | 'document_type' => 'string', |
| 187 | 190 | 'filename' => 'string', |
| ... | ... | @@ -261,6 +264,10 @@ class KTWebService |
| 261 | 264 | 'message'=>'string', |
| 262 | 265 | |
| 263 | 266 | 'document_id' => 'int', |
| 267 | + | |
| 268 | + 'custom_document_no' => 'string', | |
| 269 | + 'oem_document_no' => 'string', | |
| 270 | + | |
| 264 | 271 | 'title' => 'string', |
| 265 | 272 | 'document_type' => 'string', |
| 266 | 273 | 'full_path' => 'string', |
| ... | ... | @@ -279,7 +286,7 @@ class KTWebService |
| 279 | 286 | |
| 280 | 287 | 'owned_by'=>'string', |
| 281 | 288 | |
| 282 | - 'version' => 'string', | |
| 289 | + 'version' => 'float', | |
| 283 | 290 | |
| 284 | 291 | 'is_immutable'=>'boolean', |
| 285 | 292 | 'permissions' => 'string', |
| ... | ... | @@ -293,6 +300,7 @@ class KTWebService |
| 293 | 300 | |
| 294 | 301 | 'storage_path' => 'string', |
| 295 | 302 | |
| 303 | + | |
| 296 | 304 | 'metadata' => "{urn:$this->namespace}kt_metadata_fieldsets", |
| 297 | 305 | 'links' => "{urn:$this->namespace}kt_linked_documents", |
| 298 | 306 | 'transitions' => "{urn:$this->namespace}kt_workflow_transitions", |
| ... | ... | @@ -304,17 +312,13 @@ class KTWebService |
| 304 | 312 | if (defined('HAS_SEARCH_FUNCTIONALITY')) |
| 305 | 313 | { |
| 306 | 314 | |
| 307 | - | |
| 308 | - | |
| 309 | - | |
| 310 | - | |
| 311 | - | |
| 312 | - | |
| 313 | - | |
| 314 | 315 | $this->__typedef["{urn:$this->namespace}kt_search_result_item"] = |
| 315 | 316 | array( |
| 316 | 317 | 'document_id' => 'int', |
| 317 | 318 | |
| 319 | + 'custom_document_no' => 'string', | |
| 320 | + 'oem_document_no' => 'string', | |
| 321 | + | |
| 318 | 322 | 'relevance' => 'float', |
| 319 | 323 | 'text' => 'string', |
| 320 | 324 | |
| ... | ... | @@ -336,7 +340,7 @@ class KTWebService |
| 336 | 340 | |
| 337 | 341 | 'owned_by' => 'string', |
| 338 | 342 | |
| 339 | - 'version' => 'string', | |
| 343 | + 'version' => 'float', | |
| 340 | 344 | 'is_immutable' => 'boolean', |
| 341 | 345 | 'permissions' => 'string', |
| 342 | 346 | |
| ... | ... | @@ -462,11 +466,28 @@ class KTWebService |
| 462 | 466 | 'datetime' => 'string' |
| 463 | 467 | ); |
| 464 | 468 | |
| 469 | + if ($this->version >= 2) | |
| 470 | + { | |
| 471 | + $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = | |
| 472 | + array( | |
| 473 | + 'transaction_name'=>'string', | |
| 474 | + 'username'=>'string', | |
| 475 | + 'version' => 'float', | |
| 476 | + 'comment' => 'string', | |
| 477 | + 'datetime' => 'string' | |
| 478 | + ); | |
| 479 | + } | |
| 480 | + | |
| 481 | + | |
| 465 | 482 | $this->__typedef["{urn:$this->namespace}kt_linked_document"] = |
| 466 | 483 | array( |
| 467 | 484 | 'document_id'=>'int', |
| 468 | - 'title'=>'string', | |
| 469 | - 'size' => 'int', | |
| 485 | + 'custom_document_no' => 'string', | |
| 486 | + 'oem_document_no' => 'string', | |
| 487 | + 'title'=>'string', | |
| 488 | + 'document_type'=>'string', | |
| 489 | + 'filesize' => 'int', | |
| 490 | + 'version' => 'float', | |
| 470 | 491 | 'workflow' => 'string', |
| 471 | 492 | 'workflow_state' => 'string', |
| 472 | 493 | 'link_type' => 'string' |
| ... | ... | @@ -508,6 +529,17 @@ class KTWebService |
| 508 | 529 | 'content_version'=>'string', |
| 509 | 530 | ); |
| 510 | 531 | |
| 532 | + if ($this->version >= 2) | |
| 533 | + { | |
| 534 | + $this->__typedef["{urn:$this->namespace}kt_document_version_history_item"] = | |
| 535 | + array( | |
| 536 | + 'user'=>'string', | |
| 537 | + 'metadata_version'=>'int', | |
| 538 | + 'content_version'=>'float', | |
| 539 | + ); | |
| 540 | + } | |
| 541 | + | |
| 542 | + | |
| 511 | 543 | $this->__typedef["{urn:$this->namespace}kt_document_version_history"] = |
| 512 | 544 | array( |
| 513 | 545 | array( |
| ... | ... | @@ -1023,6 +1055,12 @@ class KTWebService |
| 1023 | 1055 | 'out' => array( 'return' => "{urn:$this->namespace}kt_client_policies_response" ), |
| 1024 | 1056 | ); |
| 1025 | 1057 | |
| 1058 | + if ($this->version >= 2) | |
| 1059 | + { | |
| 1060 | + $this->__dispatch_map['get_client_policies']['in'] = array('session_id'=>'string', 'client'=>'string'); | |
| 1061 | + | |
| 1062 | + } | |
| 1063 | + | |
| 1026 | 1064 | |
| 1027 | 1065 | } |
| 1028 | 1066 | |
| ... | ... | @@ -1717,35 +1755,59 @@ class KTWebService |
| 1717 | 1755 | $detail['version_history'] = array(); |
| 1718 | 1756 | $detail['transaction_history'] = array(); |
| 1719 | 1757 | |
| 1720 | - | |
| 1721 | 1758 | if (stripos($detailstr,'M') !== false) |
| 1722 | 1759 | { |
| 1723 | 1760 | $response = $this->get_document_metadata($session_id, $document_id); |
| 1724 | 1761 | $detail['metadata'] = $response->value['metadata']; |
| 1762 | + $detail['metadata']->name = 'metadata'; | |
| 1763 | + } | |
| 1764 | + else | |
| 1765 | + { | |
| 1766 | + $detail['metadata'] = KTWebService::_encode_metadata_fields($detail['metadata']); | |
| 1725 | 1767 | } |
| 1726 | 1768 | |
| 1727 | 1769 | if (stripos($detailstr,'L') !== false) |
| 1728 | 1770 | { |
| 1729 | - $response = $this->get_document_metadata($session_id, $document_id); | |
| 1771 | + $response = $this->get_document_links($session_id, $document_id); | |
| 1730 | 1772 | $detail['links'] = $response->value['links']; |
| 1773 | + $detail['links']->name = 'links'; | |
| 1774 | + } | |
| 1775 | + else | |
| 1776 | + { | |
| 1777 | + $detail['links'] = KTWebService::_encode_document_links($detail['links']); | |
| 1731 | 1778 | } |
| 1732 | 1779 | |
| 1733 | 1780 | if (stripos($detailstr,'T') !== false) |
| 1734 | 1781 | { |
| 1735 | 1782 | $response = $this->get_document_workflow_transitions($session_id, $document_id); |
| 1736 | - $detail['transitions'] = $response->value['transitions']; | |
| 1783 | + $detail['transitions'] = $response->value['transitions'] ; | |
| 1784 | + $detail['transitions']->name = 'transitions'; | |
| 1785 | + } | |
| 1786 | + else | |
| 1787 | + { | |
| 1788 | + $detail['transitions'] = KTWebService::_encode_document_workflow_transitions($detail['transitions']); | |
| 1737 | 1789 | } |
| 1738 | 1790 | |
| 1739 | 1791 | if (stripos($detailstr,'V') !== false) |
| 1740 | 1792 | { |
| 1741 | 1793 | $response = $this->get_document_version_history($session_id, $document_id); |
| 1742 | - $detail['version_history'] = $response->value['history']; | |
| 1794 | + $detail['version_history'] = $response->value['history']; | |
| 1795 | + $detail['version_history']->name = 'version_history'; | |
| 1796 | + } | |
| 1797 | + else | |
| 1798 | + { | |
| 1799 | + $detail['version_history'] = KTWebService::_encode_version_history($detail['version_history'],'version_history'); | |
| 1743 | 1800 | } |
| 1744 | 1801 | |
| 1745 | 1802 | if (stripos($detailstr,'H') !== false) |
| 1746 | 1803 | { |
| 1747 | 1804 | $response = $this->get_document_transaction_history($session_id, $document_id); |
| 1748 | - $detail['transaction_history'] = $response->value['history']; | |
| 1805 | + $detail['transaction_history'] = $response->value['history']; | |
| 1806 | + $detail['transaction_history']->name = 'transaction_history'; | |
| 1807 | + } | |
| 1808 | + else | |
| 1809 | + { | |
| 1810 | + $detail['transaction_history'] = KTWebService::_encode_transaction_history($detail['transaction_history'],'transaction_history'); | |
| 1749 | 1811 | } |
| 1750 | 1812 | |
| 1751 | 1813 | } |
| ... | ... | @@ -1826,65 +1888,10 @@ class KTWebService |
| 1826 | 1888 | return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); |
| 1827 | 1889 | } |
| 1828 | 1890 | |
| 1829 | - $detailstr = $detail; | |
| 1830 | - | |
| 1831 | - $detail = $document->get_detail(); | |
| 1832 | - if (PEAR::isError($detail)) | |
| 1833 | - { | |
| 1834 | - $response['status_code'] = KTWS_ERR_PROBLEM; | |
| 1835 | - $response['message'] = $detail->getMessage(); | |
| 1836 | - | |
| 1837 | - $this->debug("get_document_detail_by_name - cannot get document detail - " . $detail->getMessage(), $session_id); | |
| 1838 | - | |
| 1839 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); | |
| 1840 | - } | |
| 1841 | - | |
| 1842 | - $detail['status_code']=KTWS_SUCCESS; | |
| 1843 | - $detail['message']=''; | |
| 1844 | - | |
| 1845 | - | |
| 1846 | - if ($this->version >= 2) | |
| 1847 | - { | |
| 1848 | - | |
| 1849 | - $detail['metadata'] = array(); | |
| 1850 | - $detail['links'] = array(); | |
| 1851 | - $detail['transitions'] = array(); | |
| 1852 | - $detail['version_history'] = array(); | |
| 1853 | - $detail['transaction_history'] = array(); | |
| 1854 | - | |
| 1855 | - if (stripos($detailstr,'M') !== false) | |
| 1856 | - { | |
| 1857 | - $response = $this->get_document_metadata($session_id, $document_id); | |
| 1858 | - $detail['metadata'] = $response->value['metadata']; | |
| 1859 | - } | |
| 1860 | - | |
| 1861 | - if (stripos($detailstr,'L') !== false) | |
| 1862 | - { | |
| 1863 | - $response = $this->get_document_metadata($session_id, $document_id); | |
| 1864 | - $detail['links'] = $response->value['links']; | |
| 1865 | - } | |
| 1866 | - | |
| 1867 | - if (stripos($detailstr,'T') !== false) | |
| 1868 | - { | |
| 1869 | - $response = $this->get_document_workflow_transitions($session_id, $document_id); | |
| 1870 | - $detail['transitions'] = $response->value['transitions']; | |
| 1871 | - } | |
| 1891 | + return $this->get_document_detail($session_id, $document->documentid, $detail); | |
| 1892 | + } | |
| 1872 | 1893 | |
| 1873 | - if (stripos($detailstr,'V') !== false) | |
| 1874 | - { | |
| 1875 | - $response = $this->get_document_version_history($session_id, $document_id); | |
| 1876 | - $detail['version_history'] = $response->value['history']; | |
| 1877 | - } | |
| 1878 | 1894 | |
| 1879 | - if (stripos($detailstr,'H') !== false) | |
| 1880 | - { | |
| 1881 | - $response = $this->get_document_transaction_history($session_id, $document_id); | |
| 1882 | - $detail['transaction_history'] = $response->value['history']; | |
| 1883 | - } | |
| 1884 | - } | |
| 1885 | - | |
| 1886 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $detail); | |
| 1887 | - } | |
| 1888 | 1895 | |
| 1889 | 1896 | /** |
| 1890 | 1897 | * Adds a document to the repository. |
| ... | ... | @@ -3174,100 +3181,42 @@ class KTWebService |
| 3174 | 3181 | } |
| 3175 | 3182 | |
| 3176 | 3183 | /** |
| 3177 | - * Encodes the array as a kt_metadata_selection_item | |
| 3178 | - * | |
| 3179 | - * @param aray $item | |
| 3180 | - * @param string $name | |
| 3181 | - * @return SOAP_Value of kt_metadata_selection_item | |
| 3182 | - * @access private | |
| 3183 | - * @static | |
| 3184 | - */ | |
| 3185 | - function _encode_metadata_selection_item($item, $name='item') | |
| 3186 | - { | |
| 3187 | - if (!is_null($item['id'])) | |
| 3188 | - { | |
| 3189 | - $item['id'] = (int) $item['id']; | |
| 3190 | - } | |
| 3191 | - | |
| 3192 | - if (!is_null($item['parent_id'])) | |
| 3193 | - { | |
| 3194 | - $item['parent_id'] = (int) $item['parent_id']; | |
| 3195 | - } | |
| 3196 | - | |
| 3197 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection_item", $item); | |
| 3198 | - } | |
| 3199 | - | |
| 3200 | - /** | |
| 3201 | - * Encode an array as kt_metadata_selection | |
| 3184 | + * Encode an array as kt_metadata_fields | |
| 3202 | 3185 | * |
| 3203 | - * @param array $selection | |
| 3186 | + * @param array $fields | |
| 3204 | 3187 | * @param string $name |
| 3205 | - * @return SOAP_Value of kt_metadata_selection | |
| 3188 | + * @return SOAP_Value of kt_metadata_fields | |
| 3206 | 3189 | * @access private |
| 3207 | 3190 | * @static |
| 3208 | 3191 | */ |
| 3209 | - | |
| 3210 | - function _encode_metadata_selection($selection, $name='selection') | |
| 3192 | + function _encode_metadata_fields($fields, $name='fields') | |
| 3211 | 3193 | { |
| 3212 | - $encoded=array(); | |
| 3213 | - foreach($selection as $field) | |
| 3214 | - { | |
| 3215 | - $encoded[] = KTWebService::_encode_metadata_selection_item($field); | |
| 3216 | - } | |
| 3217 | 3194 | |
| 3218 | - if (empty($encoded)) | |
| 3195 | + foreach($fields as $key=>$field) | |
| 3219 | 3196 | { |
| 3220 | - $encoded=null; | |
| 3221 | - } | |
| 3197 | + $selection = $field['selection']; | |
| 3198 | + foreach($selection as $skey=>$sitem) | |
| 3199 | + { | |
| 3200 | + if (!is_null($item['id'])) | |
| 3201 | + { | |
| 3202 | + $sitem['id'] = (int) $sitem['id']; | |
| 3203 | + } | |
| 3204 | + | |
| 3205 | + if (!is_null($sitem['parent_id'])) | |
| 3206 | + { | |
| 3207 | + $sitem['parent_id'] = (int) $sitem['parent_id']; | |
| 3208 | + } | |
| 3209 | + $selection[$skey] = new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection_item", $sitem); | |
| 3210 | + } | |
| 3222 | 3211 | |
| 3223 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection", $encoded); | |
| 3224 | - } | |
| 3212 | + $field['selection'] = new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection", $selection); | |
| 3225 | 3213 | |
| 3226 | - /** | |
| 3227 | - * Encode an array as kt_metadata_field | |
| 3228 | - * | |
| 3229 | - * @param arra $field | |
| 3230 | - * @param string $name | |
| 3231 | - * @return SOAP_Value of kt_metadata_field | |
| 3232 | - * @access private | |
| 3233 | - * @static | |
| 3234 | - */ | |
| 3214 | + $field['required'] = is_null($field['required'])?false:(bool) $field['required']; | |
| 3235 | 3215 | |
| 3236 | - function _encode_metadata_field($field, $name='field') | |
| 3237 | - { | |
| 3238 | - if (!empty($field['selection'])) | |
| 3239 | - { | |
| 3240 | - $field['selection'] = KTWebService::_encode_metadata_selection($field['selection']); | |
| 3241 | - } | |
| 3242 | - if (!is_null($field['required'])) | |
| 3243 | - { | |
| 3244 | - $field['required'] = (bool) $field['required']; | |
| 3216 | + $fields[$key] = new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_field", $field); | |
| 3245 | 3217 | } |
| 3246 | 3218 | |
| 3247 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_field", $field); | |
| 3248 | - } | |
| 3249 | - | |
| 3250 | - /** | |
| 3251 | - * Encode an array as kt_metadata_fields | |
| 3252 | - * | |
| 3253 | - * @param array $fields | |
| 3254 | - * @param string $name | |
| 3255 | - * @return SOAP_Value of kt_metadata_fields | |
| 3256 | - * @access private | |
| 3257 | - * @static | |
| 3258 | - */ | |
| 3259 | - function _encode_metadata_fields($fields, $name='fields') | |
| 3260 | - { | |
| 3261 | - $encoded=array(); | |
| 3262 | - foreach($fields as $field) | |
| 3263 | - { | |
| 3264 | - $encoded[] = KTWebService::_encode_metadata_field($field); | |
| 3265 | - } | |
| 3266 | - if (empty($encoded)) | |
| 3267 | - { | |
| 3268 | - $encoded=null; | |
| 3269 | - } | |
| 3270 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_fields", $encoded); | |
| 3219 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_fields", $fields); | |
| 3271 | 3220 | } |
| 3272 | 3221 | |
| 3273 | 3222 | /** |
| ... | ... | @@ -3558,11 +3507,16 @@ class KTWebService |
| 3558 | 3507 | } |
| 3559 | 3508 | |
| 3560 | 3509 | $response['status_code'] = KTWS_SUCCESS; |
| 3561 | - $response['transitions'] = $result; | |
| 3510 | + $response['transitions'] = KTWebService::_encode_document_workflow_transitions($result); | |
| 3562 | 3511 | |
| 3563 | 3512 | return new SOAP_Value('return',"{urn:$this->namespace}kt_workflow_transitions_response", $response); |
| 3564 | 3513 | } |
| 3565 | 3514 | |
| 3515 | + function _encode_document_workflow_transitions($transitions, $name='transitions') | |
| 3516 | + { | |
| 3517 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_workflow_transitions", $transitions); | |
| 3518 | + } | |
| 3519 | + | |
| 3566 | 3520 | /** |
| 3567 | 3521 | * Returns the current state that the document is in. |
| 3568 | 3522 | * |
| ... | ... | @@ -3608,20 +3562,6 @@ class KTWebService |
| 3608 | 3562 | } |
| 3609 | 3563 | |
| 3610 | 3564 | /** |
| 3611 | - * Encode an array as kt_document_transaction_history_item | |
| 3612 | - * | |
| 3613 | - * @param array $item | |
| 3614 | - * @param string $name | |
| 3615 | - * @return SOAP_Value of kt_document_transaction_history_item | |
| 3616 | - * @access private | |
| 3617 | - * @static | |
| 3618 | - */ | |
| 3619 | - function _encode_transaction_history_item($item, $name='item') | |
| 3620 | - { | |
| 3621 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history_item", $item); | |
| 3622 | - } | |
| 3623 | - | |
| 3624 | - /** | |
| 3625 | 3565 | * Encode an array as kt_document_transaction_history |
| 3626 | 3566 | * |
| 3627 | 3567 | * @param array $history |
| ... | ... | @@ -3632,29 +3572,12 @@ class KTWebService |
| 3632 | 3572 | */ |
| 3633 | 3573 | function _encode_transaction_history($history, $name='history') |
| 3634 | 3574 | { |
| 3635 | - $encoded=array(); | |
| 3636 | - foreach($history as $item) | |
| 3575 | + foreach($history as $key=>$item) | |
| 3637 | 3576 | { |
| 3638 | - $encoded[] = KTWebService::_encode_transaction_history_item($item); | |
| 3577 | + $history[$key] = new SOAP_Value('item',"{urn:$this->namespace}kt_document_transaction_history_item", $item); | |
| 3639 | 3578 | } |
| 3640 | 3579 | |
| 3641 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history", $encoded); | |
| 3642 | - } | |
| 3643 | - | |
| 3644 | - /** | |
| 3645 | - * Encode an array as kt_document_transaction_history_response | |
| 3646 | - * | |
| 3647 | - * @param array $response | |
| 3648 | - * @param string $name | |
| 3649 | - * @return SOAP_Value of kt_document_transaction_history_response | |
| 3650 | - * @access private | |
| 3651 | - * @static | |
| 3652 | - */ | |
| 3653 | - function _encode_transaction_history_response($response, $name='return') | |
| 3654 | - { | |
| 3655 | - $response['history'] = KTWebService::_encode_transaction_history($response['history']); | |
| 3656 | - | |
| 3657 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history_response", $response); | |
| 3580 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history", $history); | |
| 3658 | 3581 | } |
| 3659 | 3582 | |
| 3660 | 3583 | /** |
| ... | ... | @@ -3695,23 +3618,9 @@ class KTWebService |
| 3695 | 3618 | } |
| 3696 | 3619 | |
| 3697 | 3620 | $response['status_code'] = KTWS_SUCCESS; |
| 3698 | - $response['history'] = $result; | |
| 3621 | + $response['history'] = KTWebService::_encode_transaction_history($result); | |
| 3699 | 3622 | |
| 3700 | - return KTWebService::_encode_transaction_history_response($response); | |
| 3701 | - } | |
| 3702 | - | |
| 3703 | - /** | |
| 3704 | - * Encode an array as kt_document_version_history_item | |
| 3705 | - * | |
| 3706 | - * @param array $item | |
| 3707 | - * @param string $name | |
| 3708 | - * @return SOAP_Value of kt_document_version_history_item | |
| 3709 | - * @access private | |
| 3710 | - * @static | |
| 3711 | - */ | |
| 3712 | - function _encode_version_history_item($item, $name='item') | |
| 3713 | - { | |
| 3714 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history_item", $item); | |
| 3623 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_transaction_history_response", $response); | |
| 3715 | 3624 | } |
| 3716 | 3625 | |
| 3717 | 3626 | /** |
| ... | ... | @@ -3725,33 +3634,15 @@ class KTWebService |
| 3725 | 3634 | */ |
| 3726 | 3635 | function _encode_version_history($history, $name='history') |
| 3727 | 3636 | { |
| 3728 | - $encoded=array(); | |
| 3729 | - foreach($history as $item) | |
| 3637 | + foreach($history as $key=>$item) | |
| 3730 | 3638 | { |
| 3731 | - $encoded[] = KTWebService::_encode_version_history_item($item); | |
| 3639 | + $history[$key] = new SOAP_Value('item',"{urn:$this->namespace}kt_document_version_history_item", $item); | |
| 3732 | 3640 | } |
| 3733 | 3641 | |
| 3734 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history", $encoded); | |
| 3642 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history", $history); | |
| 3735 | 3643 | } |
| 3736 | 3644 | |
| 3737 | 3645 | /** |
| 3738 | - * Encode an array as kt_document_version_history_response | |
| 3739 | - * | |
| 3740 | - * @param array $response | |
| 3741 | - * @param string $name | |
| 3742 | - * @return SOAP_Value of kt_document_version_history_response | |
| 3743 | - * @access private | |
| 3744 | - * @static | |
| 3745 | - */ | |
| 3746 | - function _encode_version_history_response($response, $name='return') | |
| 3747 | - { | |
| 3748 | - $response['history'] = KTWebService::_encode_version_history($response['history']); | |
| 3749 | - | |
| 3750 | - return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history_response", $response); | |
| 3751 | - } | |
| 3752 | - | |
| 3753 | - | |
| 3754 | - /** | |
| 3755 | 3646 | * Returns the version history. |
| 3756 | 3647 | * |
| 3757 | 3648 | * @param string $session_id |
| ... | ... | @@ -3790,9 +3681,9 @@ class KTWebService |
| 3790 | 3681 | } |
| 3791 | 3682 | |
| 3792 | 3683 | $response['status_code'] = KTWS_SUCCESS; |
| 3793 | - $response['history'] = $result; | |
| 3684 | + $response['history'] =KTWebService::_encode_version_history($result); | |
| 3794 | 3685 | |
| 3795 | - return KTWebService::_encode_version_history_response($response); | |
| 3686 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_version_history_response", $response); | |
| 3796 | 3687 | } |
| 3797 | 3688 | |
| 3798 | 3689 | |
| ... | ... | @@ -3830,12 +3721,26 @@ class KTWebService |
| 3830 | 3721 | } |
| 3831 | 3722 | |
| 3832 | 3723 | $links = $document->get_linked_documents(); |
| 3833 | - $response['links'] = new SOAP_Value('links',"{urn:$this->namespace}kt_linked_documents", $links); | |
| 3724 | + $response['links'] = KTWebService::_encode_document_links($links); | |
| 3834 | 3725 | $response['status_code'] = KTWS_SUCCESS; |
| 3835 | 3726 | |
| 3836 | 3727 | return new SOAP_Value('return',"{urn:$this->namespace}kt_linked_document_response", $response); |
| 3837 | 3728 | } |
| 3838 | 3729 | |
| 3730 | + function _encode_document_links($links, $name='links') | |
| 3731 | + { | |
| 3732 | + foreach($links as $key=>$link) | |
| 3733 | + { | |
| 3734 | + $link['document_id'] = (int) $link['document_id']; | |
| 3735 | + $link['filesize'] = (int) $link['filesize']; | |
| 3736 | + | |
| 3737 | + $links[$key] = new SOAP_Value('links',"{urn:$this->namespace}kt_linked_document", $link); | |
| 3738 | + } | |
| 3739 | + | |
| 3740 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_linked_documents", $links); | |
| 3741 | + } | |
| 3742 | + | |
| 3743 | + | |
| 3839 | 3744 | /** |
| 3840 | 3745 | * Removes a link between documents |
| 3841 | 3746 | * |
| ... | ... | @@ -3940,17 +3845,13 @@ class KTWebService |
| 3940 | 3845 | } |
| 3941 | 3846 | |
| 3942 | 3847 | function _encode_client_policies($policies) |
| 3943 | - { | |
| 3944 | - $encoded=array(); | |
| 3945 | - foreach($policies as $policy) | |
| 3946 | - { | |
| 3947 | - $encoded[] = new SOAP_Value('policy',"{urn:$this->namespace}kt_client_policy", $policy); | |
| 3948 | - } | |
| 3949 | - if (empty($encoded)) | |
| 3848 | + { | |
| 3849 | + foreach($policies as $key=>$policy) | |
| 3950 | 3850 | { |
| 3951 | - $encoded=null; | |
| 3851 | + $policies[$key] = new SOAP_Value('policy',"{urn:$this->namespace}kt_client_policy", $policy); | |
| 3952 | 3852 | } |
| 3953 | - return new SOAP_Value('policies',"{urn:$this->namespace}kt_client_policies_array", $encoded); | |
| 3853 | + | |
| 3854 | + return new SOAP_Value('policies',"{urn:$this->namespace}kt_client_policies_array", $policies); | |
| 3954 | 3855 | } |
| 3955 | 3856 | |
| 3956 | 3857 | /** |
| ... | ... | @@ -3959,7 +3860,7 @@ class KTWebService |
| 3959 | 3860 | * @param string $session_id |
| 3960 | 3861 | * @return kt_client_policies_response |
| 3961 | 3862 | */ |
| 3962 | - function get_client_policies($session_id) | |
| 3863 | + function get_client_policies($session_id, $client=null) | |
| 3963 | 3864 | { |
| 3964 | 3865 | $this->debug("get_client_policies('$session_id')"); |
| 3965 | 3866 | $config = KTConfig::getSingleton(); |
| ... | ... | @@ -4227,8 +4128,7 @@ class KTWebService |
| 4227 | 4128 | |
| 4228 | 4129 | } |
| 4229 | 4130 | |
| 4230 | - | |
| 4231 | 4131 | $webservice = new KTWebService(); |
| 4232 | 4132 | $webservice->run(); |
| 4233 | 4133 | |
| 4234 | 4134 | -?> |
| 4135 | +?> | |
| 4235 | 4136 | \ No newline at end of file | ... | ... |