diff --git a/ktwsapi/README.txt b/ktwsapi/README.txt
deleted file mode 100644
index 1bfffc4..0000000
--- a/ktwsapi/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-KnowledgeTree WebService API
-============================
-
-This folder contains the object model in various languages, used to access
-KnowledgeTree via web services.
\ No newline at end of file
diff --git a/ktwsapi/cpp/TODO.txt b/ktwsapi/cpp/TODO.txt
deleted file mode 100644
index e69de29..0000000
--- a/ktwsapi/cpp/TODO.txt
+++ /dev/null
diff --git a/ktwsapi/delphi/doc/KTWSAPI.chm b/ktwsapi/delphi/doc/KTWSAPI.chm
deleted file mode 100644
index a64e7ea..0000000
--- a/ktwsapi/delphi/doc/KTWSAPI.chm
+++ /dev/null
diff --git a/ktwsapi/delphi/examples/KTWSAPIExamples.bdsproj b/ktwsapi/delphi/examples/KTWSAPIExamples.bdsproj
deleted file mode 100644
index 188af84..0000000
--- a/ktwsapi/delphi/examples/KTWSAPIExamples.bdsproj
+++ /dev/null
@@ -1,194 +0,0 @@
-
-
-
-
- Delphi.Personality
- VCLApplication
- 1.0
- {A7B8ECC5-0F7B-4E7C-8C44-8356FDCDB36A}
-
-
-
-
- KTWSAPIExamples.dpr
-
-
- 7.0
-
-
- 8
- 0
- 1
- 1
- 0
- 0
- 1
- 1
- 1
- 0
- 0
- 1
- 0
- 1
- 1
- 1
- 0
- 0
- 0
- 0
- 0
- 1
- 0
- 1
- 1
- 1
- True
- True
- WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-
- False
-
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- False
- False
- False
- True
- True
- True
- True
- True
- True
-
-
-
- 0
- 0
- False
- 1
- False
- False
- False
- 16384
- 1048576
- 4194304
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
- False
-
-
- True
- False
-
-
-
- $00000000
-
-
-
- False
- False
- 1
- 0
- 0
- 0
- False
- False
- False
- False
- False
- 1044
- 1252
-
-
-
-
- 1.0.0.0
-
-
-
-
-
- 1.0.0.0
-
-
- RemObjects Everwood for Delphi
- RemObjects SDK - Core Library
- RemObjects SDK - WebBroker Library
- RemObjects SDK - RODXSock Library
- RemObjects SDK - BPDX Library
- RemObjects SDK - DataSnap Integration Pack
- RemObjects Pascal Script - Core Package
- RemObjects Pascal Script - RemObjects SDK 3.0 Integration
- RemObjects SDK - Indy Library
- RemObjects SDK - IDE Integration for Win32
- RemObjects Data Abstract - Core Library
- RemObjects Data Abstract - IDE Package
- RemObjects Data Abstract - ADOExpress/dbGo Driver
- RemObjects Data Abstract - InterBase Express Driver
- RemObjects Data Abstract - dbExpress Driver
- RemObjects Data Abstract - Scripting Integration Library
-
-
-
-
-
diff --git a/ktwsapi/delphi/examples/KTWSAPIExamples.dpr b/ktwsapi/delphi/examples/KTWSAPIExamples.dpr
deleted file mode 100644
index 27531b9..0000000
--- a/ktwsapi/delphi/examples/KTWSAPIExamples.dpr
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- i) Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- ii) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}
-
-{*
- This is a Delphi port of the php api for KnowledgeTree WebService.
-
- @Author Bjarte Kalstveit Vebj�rnsen
- @Version 1.0 BKV 24.09.2007 Initial revision
-*}
-
-
-program KTWSAPIExamples;
-
-uses
- Forms,
- uFolderContentExample in 'uFolderContentExample.pas' {FolderContentExample},
- uwebservice in '..\uwebservice.pas',
- uktwsapi in '..\uktwsapi.pas',
- uPHPserialize in '..\uPHPserialize.pas';
-
-{$R *.res}
-
-begin
- Application.Initialize;
- Application.CreateForm(TFolderContentExample, FolderContentExample);
- Application.Run;
-end.
-
diff --git a/ktwsapi/delphi/examples/KTWSAPIExamples.res b/ktwsapi/delphi/examples/KTWSAPIExamples.res
deleted file mode 100644
index 7eb23e4..0000000
--- a/ktwsapi/delphi/examples/KTWSAPIExamples.res
+++ /dev/null
diff --git a/ktwsapi/delphi/examples/uFolderContentExample.dfm b/ktwsapi/delphi/examples/uFolderContentExample.dfm
deleted file mode 100644
index 51a0ed1..0000000
--- a/ktwsapi/delphi/examples/uFolderContentExample.dfm
+++ /dev/null
@@ -1,183 +0,0 @@
-object FolderContentExample: TFolderContentExample
- Left = 0
- Top = 0
- Caption = 'FolderContentExample'
- ClientHeight = 538
- ClientWidth = 219
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'Tahoma'
- Font.Style = []
- OldCreateOrder = False
- PixelsPerInch = 96
- TextHeight = 13
- object tvFolderList: TTreeView
- AlignWithMargins = True
- Left = 3
- Top = 34
- Width = 213
- Height = 501
- Align = alClient
- Images = ImageList4
- Indent = 19
- TabOrder = 0
- OnCollapsed = tvFolderListCollapsed
- OnExpanded = tvFolderListExpanded
- end
- object Button1: TButton
- AlignWithMargins = True
- Left = 3
- Top = 3
- Width = 213
- Height = 25
- Align = alTop
- Caption = 'Populate folders'
- TabOrder = 1
- OnClick = Button1Click
- end
- object ImageList4: TImageList
- Left = 8
- Top = 496
- Bitmap = {
- 494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
- 0000000000003600000028000000400000001000000001002000000000000010
- 00000000000000000000000000000000000000000000078DBE00078DBE00078D
- BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE00078DBE00078DBE00000000000000000000000000078DBE00078DBE00078D
- BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE00078DBE000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE0063CBF800078DBE00A3E1
- FB0066CDF90065CDF80065CDF90065CDF90065CDF80065CDF90065CDF80066CD
- F8003AADD800ACE7F500078DBE0000000000078DBE0025A1D10071C6E80084D7
- FA0066CDF90065CDF90065CDF90065CDF90065CDF80065CDF90065CDF80066CE
- F9003AADD8001999C90000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE006AD1F900078DBE00A8E5
- FC006FD4FA006FD4F9006ED4FA006FD4F9006FD4FA006FD4FA006FD4FA006ED4
- F9003EB1D900B1EAF500078DBE0000000000078DBE004CBCE70039A8D100A0E2
- FB006FD4FA006FD4F9006ED4FA006FD4F9006FD4FA006FD4FA006FD4FA006ED4
- F9003EB1D900C9F0F300078DBE00000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE0072D6FA00078DBE00AEEA
- FC0079DCFB0079DCFB0079DCFB0079DCFB0079DCFB007ADCFB0079DCFA0079DC
- FA0044B5D900B6EEF600078DBE0000000000078DBE0072D6FA00078DBE00AEE9
- FC0079DCFB0079DCFB0079DCFB0079DCFB0079DCFB007ADCFB0079DCFA0079DC
- FA0044B5D900C9F0F300078DBE00000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE0079DDFB00078DBE00B5EE
- FD0083E4FB0084E4FB0083E4FC0083E4FC0084E4FC0083E4FC0083E4FB0084E5
- FC0048B9DA00BBF2F600078DBE0000000000078DBE0079DDFB001899C7009ADF
- F30092E7FC0084E4FB0083E4FC0083E4FC0084E4FC0083E4FC0083E4FB0084E5
- FC0048B9DA00C9F0F3001496C400000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE0082E3FC00078DBE00BAF3
- FD008DEBFC008DEBFC008DEBFC008DEBFD008DEBFD008DEBFC008DEBFD008DEB
- FC004CBBDA00BEF4F700078DBE0000000000078DBE0082E3FC0043B7DC0065C2
- E000ABF0FC008DEBFC008DEBFC008DEBFD008DEBFD008DEBFC008DEBFD008DEB
- FC004CBBDA00C9F0F300C9F0F300078DBE000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE008AEAFC00078DBE00FFFF
- FF00C9F7FE00C8F7FE00C9F7FE00C9F7FE00C9F7FE00C8F7FE00C9F7FE00C8F7
- FE009BD5E700DEF9FB00078DBE0000000000078DBE008AEAFC0077DCF300219C
- C700FEFFFF00C8F7FD00C9F7FD00C9F7FD00C9F7FE00C8F7FE00C9F7FD00C8F7
- FE009BD5E600EAFEFE00D2F3F800078DBE000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE0093F0FE00078DBE00078D
- BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE00078DBE00078DBE00078DBE0000000000078DBE0093F0FE0093F0FD001697
- C500078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE00078DBE00078DBE00078DBE00078DBE000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE009BF5FE009AF6FE009AF6
- FE009BF5FD009BF6FE009AF6FE009BF5FE009AF6FD009BF5FE009AF6FE009AF6
- FE000989BA00000000000000000000000000078DBE009BF5FE009AF6FE009AF6
- FE009BF5FD009BF6FE009AF6FE009BF5FE009AF6FD009BF5FE009AF6FE009AF6
- FE000989BA000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000078DBE00FEFEFE00A0FBFF00A0FB
- FE00A0FBFE00A1FAFE00A1FBFE00A0FAFE00A1FBFE00A1FBFF00A0FBFF00A1FB
- FF000989BA00000000000000000000000000078DBE00FEFEFE00A0FBFF00A0FB
- FE00A0FBFE00A1FAFE00A1FBFE00A0FAFE00A1FBFE00A1FBFF00A0FBFF00A1FB
- FF000989BA000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 00000000000000000000000000000000000000000000078DBE00FEFEFE00A5FE
- FF00A5FEFF00A5FEFF00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE000000000000000000000000000000000000000000078DBE00FEFEFE00A5FE
- FF00A5FEFF00A5FEFF00078DBE00078DBE00078DBE00078DBE00078DBE00078D
- BE00000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000078DBE00078D
- BE00078DBE00078DBE0000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000078DBE00078D
- BE00078DBE00078DBE0000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 0000000000000000000000000000000000000000000000000000000000000000
- 000000000000000000000000000000000000424D3E000000000000003E000000
- 2800000040000000100000000100010000000000800000000000000000000000
- 000000000000000000000000FFFFFF0080038007000000000001000300000000
- 0001000100000000000100010000000000010001000000000001000000000000
- 0001000000000000000100000000000000070007000000000007000700000000
- 800F800F00000000C3FFC3FF00000000FFFFFFFF00000000FFFFFFFF00000000
- FFFFFFFF00000000FFFFFFFF0000000000000000000000000000000000000000
- 000000000000}
- end
-end
diff --git a/ktwsapi/delphi/examples/uFolderContentExample.pas b/ktwsapi/delphi/examples/uFolderContentExample.pas
deleted file mode 100644
index 728495c..0000000
--- a/ktwsapi/delphi/examples/uFolderContentExample.pas
+++ /dev/null
@@ -1,108 +0,0 @@
-unit uFolderContentExample;
-
-interface
-
-uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, uKtwsapi, uWebService, ImgList, ComCtrls, StdCtrls;
-
-type
- TFolderContentExample = class(TForm)
- tvFolderList: TTreeView;
- ImageList4: TImageList;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- procedure tvFolderListCollapsed(Sender: TObject; Node: TTreeNode);
- procedure tvFolderListExpanded(Sender: TObject; Node: TTreeNode);
- private
- { Private declarations }
- FIsPopulating: Boolean;
- procedure PopulateTreeView(items: kt_folder_items;
- parent: TTreeNode; tv: TTreeView);
- public
- { Public declarations }
- end;
-
-var
- FolderContentExample: TFolderContentExample;
- UserName, Password: String;
-
-implementation
-
-{$R *.dfm}
-
-procedure TFolderContentExample.Button1Click(Sender: TObject);
-var
- ktapi: TKTWSAPI;
- folder: TKTWSAPI_Folder;
- contents: kt_folder_contents;
-begin
- if FIsPopulating then Exit;
-
- Screen.Cursor := crHourglass;
-
- FIsPopulating := True;
- ktapi := TKTWSAPI.Create;
- try
- ktapi.SetDownloadPath(ExtractFileDir(Application.ExeName));
- ktapi.StartSession(UserName,Password);
-
- folder:= ktapi.GetRootFolder;
- try
- contents := folder.GetListing(10);
- try
- PopulateTreeView(contents.items, nil, tvFolderList);
- finally
- contents.Free;
- end;
- finally
- folder.Free;
- end;
-
- ktapi.Logout;
- finally
- ktapi.Free;
- Screen.Cursor := crDefault;
- FIsPopulating := False;
- end;
-end;
-
-procedure TFolderContentExample.PopulateTreeView(items: kt_folder_items; parent: TTreeNode;
- tv: TTreeView);
-var
- I: Integer;
- node: TTreeNode;
- it: kt_folder_item;
-begin
- for I := 0 to Length(items) - 1 do
- begin
- it := items[i];
- if it.item_type <> 'F' then Continue;
- node := tv.Items.AddChild(parent, it.title);
- node.ImageIndex := 0;
- node.Data := it;
- if (Length(it.items) > 0) then
- PopulateTreeView(it.items, node, tv);
- end;
-end;
-
-procedure TFolderContentExample.tvFolderListCollapsed(Sender: TObject;
- Node: TTreeNode);
-begin
- Node.ImageIndex := 0;
-end;
-
-procedure TFolderContentExample.tvFolderListExpanded(Sender: TObject;
- Node: TTreeNode);
-begin
- Node.ImageIndex := 1;
-end;
-
-initialization
- UserName := 'xxxx';
- Password := 'xxxx';
- uktwsapi.KTWebServerUrl := 'http://ktdms.trunk';
- uktwsapi.KTWebServiceUrl := uktwsapi.KTWebServerUrl+'/ktwebservice/webservice.php?wsdl';
- uktwsapi.KTUploadUrl := uktwsapi.KTWebServerUrl+'/ktwebservice/upload.php';
-
-end.
diff --git a/ktwsapi/delphi/uPHPserialize.pas b/ktwsapi/delphi/uPHPserialize.pas
deleted file mode 100644
index 38905c8..0000000
--- a/ktwsapi/delphi/uPHPserialize.pas
+++ /dev/null
@@ -1,469 +0,0 @@
-{
- Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- i) Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- ii) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}
-
-{*
- A helper unit to unserialize a php serialized string
-
- Inspired by the various implementaions presented here
- http://www.phpguru.org/static/PHP_Unserialize.html
-
- @Author Bjarte Kalstveit Vebjørnsen
- @Version 1.0 BKV 24.09.2007 Initial revision
- @Todo A complementary serializing function would be nice
-*}
-
-unit uPHPSerialize;
-
-interface
-
-uses
- Classes, SysUtils, Variants, ComCtrls;
-
-type
- TPHPValue = class;
- TPHPArray = class;
- TPHPSerialize = class;
-
- /// a single hash element
- TPHPHashElement = record
- Key: TPHPValue; /// The Key part of the element
- Value: TPHPValue; /// The Value part of the element
- end;
-
- /// an array of hash elements
- TPHPHashedElementArray = array of TPHPHashElement;
-
- /// Tries to replicate a php array by accessing values through strings
- /// @Todo: Add support for numeric keys
- TPHPArray = class
- private
- FElements: TPHPHashedElementArray; /// array of hash elements
- function GetValue(Key: string): TPHPValue; overload;
- function GetValue(Key: TPHPValue): TPHPValue; overload;
- procedure SetValue(Key: TPHPValue; VValue: TPHPValue); overload;
- function GetCount: Integer;
- function Getempty: Boolean;
- public
- property Value[Key: string]: TPHPValue read GetValue; default;
- property Value[Key: TPHPValue]: TPHPValue read GetValue write SetValue; default;
- property Count: Integer read GetCount;
- property Empty: Boolean read Getempty;
- procedure Clear;
- constructor Create;
- destructor Destroy; override;
- end;
-
- /// Tries to represent a PHP value of any type
- TPHPValue = class
- private
- FObj: TObject; /// Holds value if it's an object or array
- FValue: String; /// Holds value if it's something else
- procedure Clear;
- public
- constructor Create(Value: TObject); overload;
- constructor Create(Value: String); overload;
- destructor Destroy; override;
- function AsString: String;
- function AsDouble: Double;
- function AsInteger: Integer;
- function AsObject: TObject;
- function AsArray: TPHPArray;
- function AsBoolean: Boolean;
- end;
-
- /// Class for unserializing a php serialized string
- TPHPSerialize = class
- private
- function GetLength(Data: String): Integer;
- function GetIntLength(Value: Integer): Integer;
- public
- class function Unserialize(Data: String): TPHPValue;
- function _Unserialize(var Data: String): TPHPValue;
- end;
-
-implementation
-
-{ TPHPSerialize }
-
-{*
- Finds the length of they to the type
-
- @param string Data
- @return integer
-*}
-function TPHPSerialize.GetLength(Data: String): Integer;
-begin
- Data := Copy(Data, 3, Length(Data));
-
- Result := StrToIntDef(Copy(Data, 0, Pos(':', Data)-1), 0);
-end;
-
-{*
- Finds the lenght of the character-space the value occupies
-
- @param integer Value
- @return Integer
-*}
-function TPHPSerialize.GetIntLength(Value: Integer): Integer;
-begin
- Result := Length(IntToStr(Value));
-end;
-
-{*
- Helper function to use this class statically
-
- @param integer Value
- @return Integer
-*}
-class function TPHPSerialize.Unserialize(Data: String): TPHPValue;
-var
- obj: TPHPSerialize;
-begin
- obj := TPHPSerialize.Create;
- try
- Result := obj._Unserialize(Data);
- finally
- obj.Free;
- end;
-end;
-
-{*
- Recursing function for unserializing a string and creating a php value from it
-
- @see TPHPValue
- @param Data String
- @return TPHPValue
-*}
-function TPHPSerialize._Unserialize(var Data: String): TPHPValue;
-var
- I, Len: Integer;
- Num: Double;
- C: String;
- Arr: TPHPArray;
- Key, Value: TPHPValue;
-begin
- C := Copy(Data,0,1);
-
- if (C = 'a') then
- begin
- Len := GetLength(Data);
- Data := Copy(Data, GetIntLength(Len) + 5, Length(Data) );
-
- Arr := TPHPArray.Create;
- for I := 0 to Len-1 do
- begin
- Key := _Unserialize(Data);
- Value := _Unserialize(Data);
-
- Arr[Key] := Value;
- end;
-
- Data := Copy(Data, Length(Data));
- Result := TPHPValue.Create(Arr);
-
- end else if (C = 's') then
- begin
- Len := GetLength(Data);
- Result := TPHPValue.Create(Copy(Data, GetIntLength(Len) + 5, Len));
- Data := Copy(Data, GetIntLength(Len) + 7 + Len, Length(Data));
- end else if (C = 'i') or (C = 'd') then
- begin
- Num := StrToFloat(Copy(Data, 3, AnsiPos(';', Data)-3));
- Result := TPHPValue.Create(FloatToStr(Num));
- Data := Copy(Data, Length(FloatToStr(Num)) + 4, Length(Data));
- end else if (C = 'b') then
- begin
- Result := TPHPValue.Create(BoolToStr(Copy(Data, 3, 1) = '1'));
- Data := Copy(Data, 4, Length(Data));
- end else if (C = 'O') or (C = 'r') or (C = 'C') or (C = 'R')
- or (C = 'U') then
- begin
- raise Exception.Create('Unsupported PHP data type found!');
- end else if (C = 'N') then
- begin
- Result := TPHPValue.Create(nil);
- Data := Copy(Data, 2, Length(Data));
- end else
- begin
- Result := TPHPValue.Create(nil);
- Data := '';
- end;
-end;
-
-
-{ TPHPValue }
-
-{*
- Returns value as boolan
-
- @return boolean value
-*}
-function TPHPValue.AsBoolean: Boolean;
-begin
- Result := StrToBool(FValue);
-end;
-
-{*
- Returns value as double
-
- @return double value
-*}
-function TPHPValue.AsDouble: Double;
-begin
- Result := StrToFloat(FValue);
-end;
-
-{*
- Returns value as an associative-array
-
- @return associative-array
-*}
-function TPHPValue.AsArray: TPHPArray;
-begin
- Result := nil;
- Assert(Assigned(FObj));
-
- if (FObj.ClassType = TPHPArray) then
- Result := TPHPArray(FObj);
-end;
-
-{*
- Returns value as an integer
-
- @return integer value
-*}
-function TPHPValue.AsInteger: Integer;
-begin
- Result := StrToInt(FValue);
-end;
-
-{*
- Returns value as an object
-
- @return object value
-*}
-function TPHPValue.AsObject: TObject;
-begin
- Assert(Assigned(FObj));
- Result := FObj;
-end;
-
-{*
- Returns value as a string
-
- @return string value
-*}
-function TPHPValue.AsString: String;
-begin
- Result := FValue;
-end;
-
-{*
- Constructor
-
- @param Value Value to store
-*}
-constructor TPHPValue.Create(Value: String);
-begin
- Clear;
- FValue := Value;
-end;
-
-{*
- Constructor
-
- @param Value Value to store
-*}
-constructor TPHPValue.Create(Value: TObject);
-begin
- Clear;
- FObj := Value;
-end;
-
-{*
- Clears current value
-*}
-procedure TPHPValue.Clear;
-begin
- FValue := '';
- if Assigned(FObj) then FObj.Free;
- FObj := nil;
-end;
-
-{*
- Destructor
-*}
-destructor TPHPValue.Destroy;
-begin
- Clear;
- inherited;
-end;
-
-{ TPHPArray }
-
-
-{*
- Clears whole array
-*}
-procedure TPHPArray.Clear;
-var
- i: Integer;
-begin
- for i := 0 to GetCount - 1 do
- begin
- FElements[i].Key.Free;
- FElements[i].Key := nil;
- FElements[i].Value.Free;
- FElements[i].Value := nil;
- end;
- SetLength(FElements, 0);
-end;
-
-{*
- Constructor
-*}
-constructor TPHPArray.Create;
-begin
- inherited;
- Clear;
-end;
-
-{*
- Destructor
-*}
-destructor TPHPArray.Destroy;
-begin
- Clear;
- inherited;
-end;
-
-{*
- Returns the number of items in the array
-
- @return number of items
-*}
-function TPHPArray.GetCount: Integer;
-begin
- Result := Length(FElements);
-end;
-
-{*
- Checks if the array is empty
-
- @return true
-*}
-function TPHPArray.Getempty: Boolean;
-begin
- Result := Length(FElements) = 0;
-end;
-
-{*
- Fetch a phpvalue from the array
-
- @param Key Handle to phpvalue
- @return handle to phpvalue
-*}
-function TPHPArray.GetValue(Key: TPHPValue): TPHPValue;
-begin
- Result := GetValue(Key.FValue);
-end;
-
-{*
- Fetch a phpvalue from the array
-
- @param Key Index to element
- @return handle to phpvalue
-*}
-function TPHPArray.GetValue(Key: string): TPHPValue;
-var
- i: Integer;
- r: Boolean;
-begin
- Result := nil;
- i := 0;
- r := False;
- while (i < Length(FElements)) and (not r) do
- begin
- if AnsiUpperCase(FElements[i].key.AsString) = AnsiUpperCase(Key) then
- begin
- Result := FElements[i].Value;
- r := True;
- end;
- i := i + 1;
- end;
-end;
-
-{*
- Insert a phpvalue into the array
-
- @param Key Index to element
- @return handle to phpvalue
-*}
-procedure TPHPArray.SetValue(Key, VValue: TPHPValue);
-var
- i, j: Integer;
- r: Boolean;
- E: TPHPHashedElementArray;
-begin
- if VValue <> nil then
- begin
- i := 0;
- r := False;
- while (i < Length(FElements)) and not r do
- begin
- if AnsiUpperCase(FElements[i].key.AsString) = AnsiUpperCase(Key.AsString) then
- begin
- FElements[i].Value := VValue;
- r := True;
- end;
- i := i + 1;
- end;
- if not r then
- begin
- SetLength(FElements, Length(FElements) + 1);
- FElements[Length(FElements) - 1].Key := Key;
- FElements[Length(FElements) - 1].Value := Vvalue;
- end;
- end;
-
- SetLength(E, Length(FElements));
- for i := 0 to Length(FElements) - 1 do E[i] := FElements[i];
- SetLength(FElements, 0);
- for i := 0 to Length(E) - 1 do if (E[i].Key.AsString <> '')
- and (E[i].Value <> nil) then
- begin
- j := Length(FElements);
- setlength(FElements, j + 1);
- FElements[j] := E[i];
- end;
-end;
-
-end.
-
diff --git a/ktwsapi/delphi/uktwsapi.pas b/ktwsapi/delphi/uktwsapi.pas
deleted file mode 100644
index 8e8e88d..0000000
--- a/ktwsapi/delphi/uktwsapi.pas
+++ /dev/null
@@ -1,1630 +0,0 @@
-{
- Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- i) Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- ii) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}
-
-{*
- This is a Delphi port of the php api for KnowledgeTree WebService.
-
- @Author Bjarte Kalstveit Vebjørnsen
- @Version 1.0 BKV 24.09.2007 Initial revision
-*}
-
-unit uktwsapi;
-
-interface
-
-uses
- Classes, SysUtils, SOAPHTTPClient, uwebservice;
-
-type
-
- /// Base exception class
- EKTWSAPI_Exception = class(Exception);
-
- TKTWSAPI_FolderItem = class;
- TKTWSAPI_Folder = class;
- TKTWSAPI_Document = class;
- TKTWSAPI = class;
-
- /// Base class for documents and folders
- TKTWSAPI_FolderItem = class(TObject)
- private
- FKTAPI: TKTWSAPI; /// Handle to KTAPI object
- FParentId: Integer; /// Id of parent folder
-
- function _GetFileSize(FileName: WideString): WideString;
- function _UploadFile(FileName, Action: WideString; DocumentId: Integer = 0): WideString;
- function _DownloadFile(Url, LocalPath, FileName: WideString): Boolean;
- function _SaveBase64StringAsFile(Base64String, LocalPath, FileName: WideString): Boolean;
- function _LoadFileAsBase64String(FileName: WideString): WideString;
-
- public
- function GetParentFolder:TKTWSAPI_Folder;
- end;
-
- /// Class representing a folder
- TKTWSAPI_Folder = class(TKTWSAPI_FolderItem)
- private
- FFolderName, /// Name of folder
- FFullPath: WideString; /// Full path to folder
-
- FFolderId: Integer; /// Id to folder
- public
- constructor Create(KTAPI:TKTWSAPI; FolderDetail: kt_folder_detail); overload;
- class function Get(KTAPI: TKTWSAPI; FolderId:Integer): TKTWSAPI_Folder;
- function GetParentFolderId: Integer;
- function GetFolderName: WideString;
- function GetFolderId: Integer;
- function GetFolderByName(FolderName: WideString): TKTWSAPI_Folder;
- function GetFullPath: WideString;
- function GetListing(Depth: Integer=1; What: WideString = 'DF'): kt_folder_contents;
- function GetDocumentByName(Title: WideString): TKTWSAPI_Document;
- function GetDocumentByFileName(FileName: WideString): TKTWSAPI_Document;
- function AddFolder(FolderName: WideString): TKTWSAPI_Folder;
- function Delete(Reason: WideString): Boolean;
- function Rename(NewName: WideString): Boolean;
- function Move(TargetFolder:TKTWSAPI_Folder; Reason: WideString): Boolean;
- function Copy(TargetFolder:TKTWSAPI_Folder; Reason: WideString): Boolean;
- function AddDocument(FileName: WideString; Title: WideString = '';
- DocumentType: WideString = ''): TKTWSAPI_Document;
- function AddDocumentBase64(FileName: WideString; Title: WideString = '';
- DocumentType: WideString = ''): TKTWSAPI_Document;
- published
- property FolderName: WideString read FFolderName write FFolderName;
- property FullPath: WideString read FFullPath write FFullPath;
- property FolderId: Integer read FFolderId write FFolderId;
- end;
-
- /// Class representing a document
- TKTWSAPI_Document = class(TKTWSAPI_FolderItem)
- private
-
- FDocumentId: Integer; /// Id of document
- FTitle, /// Title of document
- FDocumentType, /// Type of document
- FVersion, /// Document version
- FFileName, /// Original filename
- FCreatedDate, /// Date created
- FCreatedBy, /// Name of user who created
- FUpdatedDate, /// Date updated
- FUpdatedBy, /// Name of user who updated
- FWorkflow, /// Workflow
- FWorkflowState, /// Workflow state
- FCheckoutBy, /// Name of user who checked out
- FFullPath: WideString; /// Full path to document
- public
- constructor Create(KTAPI: TKTWSAPI; DocumentDetail: kt_document_detail);
-
- class function Get(KTAPI: TKTWSAPI; DocumentId: Integer;
- LoadInfo: Boolean = System.True): TKTWSAPI_Document;
- function Checkin(FileName, Reason: WideString; MajorUpdate: Boolean): Boolean;
- function Checkout(Reason: WideString; LocalPath: WideString = '';
- DownloadFile: Boolean = True): Boolean;
- function UndoCheckout(Reason: WideString): Boolean;
- function Download(Version: WideString = ''; LocalPath: WideString = ''; FileName: WideString = ''): Boolean;
- function Delete(Reason: WideString): Boolean;
- function ChangeOwner(UserName, Reason: WideString): Boolean;
- function Copy(Folder: TKTWSAPI_Folder; Reason: WideString;
- NewTitle: WideString = ''; NewFileName: WideString = ''): Boolean;
- function Move(Folder: TKTWSAPI_Folder; Reason: WideString;
- NewTitle: WideString = ''; NewFileName: WideString = ''): Boolean;
- function ChangeDocumentType(DocumentType: WideString): Boolean;
- function RenameTitle(NewTitle: WideString): Boolean;
- function RenameFilename(NewFilename: WideString): Boolean;
- function StartWorkflow(WorkFlow: WideString): Boolean;
- function DeleteWorkflow: Boolean;
- function PeformWorkflowTransition(Transition, Reason: WideString): Boolean;
- function GetMetadata:kt_metadata_response;
- function UpdateMetadata(Metadata: kt_metadata_fieldsets): Boolean;
- function GetTransactionHistory: kt_document_transaction_history_response;
- function GetVersionHistory: kt_document_version_history_response;
- function GetLinks: kt_linked_document_response;
- function Link(DocumentId: Integer; const LinkType: WideString): Boolean;
- function Unlink(DocumentId: Integer): Boolean;
- function CheckinBase64(FileName, Reason: WideString; MajorUpdate: Boolean): Boolean;
- function CheckoutBase64(Reason: WideString; LocalPath: WideString = '';
- DownloadFile: Boolean = True): Boolean;
- function DownloadBase64(Version: WideString = ''; LocalPath: WideString = ''): Boolean;
- function GetTypes: kt_document_types_response;
- function GetLinkTypes: kt_document_types_response;
-
- property DocumentId: Integer read FDocumentId write FDocumentId;
- property Title: WideString read FTitle write FTitle;
- property DocumentType: WideString read FDocumentType write FDocumentType;
- property Version: WideString read FVersion write FVersion;
- property FileName: WideString read FFileName write FFileName;
- property CreatedDate: WideString read FCreatedBy write FCreatedBy;
- property CreatedBy: WideString read FCreatedBy write FCreatedBy;
- property UpdatedDate: WideString read FUpdatedDate write FUpdatedDate;
- property UpdatedBy: WideString read FUpdatedBy write FUpdatedBy;
- property Workflow: WideString read FWorkflow write FWorkflow;
- property WorkflowState: WideString read FWorkflowState write FWorkflowState;
- property CheckoutBy: WideString read FCheckoutBy write FCheckoutBy;
- property FullPath: WideString read FFullPath write FFullPath;
- end;
-
- /// Api entry point
- TKTWSAPI = class
- private
-
- FSession, /// Current session id
- FDownloadPath: WideString; /// Current download path
-
- FSoapClient:KnowledgeTreePort; /// Object implementing the
- /// KnowledgeTreePort interface
- public
- constructor Create();
- function GetDownloadPath: WideString;
- function SetDownloadPath(DownloadPath:WideString): Boolean;
- function StartAnonymousSession(Ip: WideString = ''): WideString;
- function StartSession(Username, Password: WideString; Ip: WideString = ''): WideString;
- function ActiveSession(Session: WideString; Ip: WideString = ''): WideString;
- function Logout: Boolean;
- function GetRootFolder: TKTWSAPI_Folder;
- function GetFolderById(FolderId: Integer): TKTWSAPI_Folder;
- function GetDocumentById(DocumentId: Integer): TKTWSAPI_Document;
- published
- property SoapClient: KnowledgeTreePort read FSoapClient write FSoapClient;
- property Session: WideString read FSession write FSession;
- end;
-var
- KTWebServerUrl: WideString; /// Your webserver url
- KTUploadUrl: WideString; /// URL to the web-service upload.php
- KTWebServiceUrl: WideString; /// URL to the web-service wsdl
-
-implementation
-
-uses
- IdComponent, IdURI, IdHttp, IdMultipartFormData, IdGlobalProtocols,
- uPHPSerialize, EncdDecd;
-const
- KTWSAPI_ERR_SESSION_IN_USE =
- 'There is a session already active.'; /// Exception message when session is in use
- KTWSAPI_ERR_SESSION_NOT_STARTED =
- 'An active session has not been started.'; /// Exception message when session is not started
-
-
-{ TKTWSAPI_FolderItem }
-
-{*
- Finds the filesize of a file.
-
- @param FileName Path to the file
- @return The size of the file as a string
-*}
-function TKTWSAPI_FolderItem._GetFileSize(FileName: WideString): WideString;
-var
- SearchRec: TSearchRec;
- sgPath: string;
- inRetval, I1: Integer;
-begin
- sgPath := ExpandFileName(FileName);
- try
- inRetval := FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec);
- if inRetval = 0 then
- I1 := SearchRec.Size
- else
- I1 := -1;
- finally
- SysUtils.FindClose(SearchRec);
- end;
- Result := IntToStr(I1);
-end;
-
-{*
- Reads a file into a string and base64 encodes it.
-
- @param Base64String Base64 encoded string
- @param LocalPath Path to load from
- @param FileName FileName to read
- @return base64 encoded string
- @throws EKTWSAPI_Exception 'Could not access file to read.'
-*}
-function TKTWSAPI_FolderItem._LoadFileAsBase64String(FileName: WideString): WideString;
-var
- Stream: TFileStream;
- InString: AnsiString;
-begin
- if not FileExists(FileName) then
- raise EKTWSAPI_Exception.Create('Could not access file to read.');
- Stream := TFileStream.Create(FileName, fmOpenRead);
- try
- SetLength(InString, Stream.Size);
- Stream.ReadBuffer(InString[1], Length(InString));
- Result := EncodeString(InString);
- finally
- Stream.Free;
- end;
-end;
-
-{*
- Save a Base64 encoded string as a file.
-
- @param Base64String Base64 encoded string
- @param LocalPath Path to save to
- @param FileName FileName to save as
- @return true if success
-*}
-function TKTWSAPI_FolderItem._SaveBase64StringAsFile(Base64String, LocalPath,
- FileName: WideString): Boolean;
-var
- OutString: AnsiString;
- Stream: TFileStream;
- LocalFileName: String;
-begin
- LocalFileName := LocalPath + '/' + FileName;
- OutString := DecodeString(Base64String);
- Stream := TFileStream.Create(LocalFileName, fmCreate);
- try
- // For some reason it fails if I use WideString instead of AnsiString
- Stream.WriteBuffer(Pointer(OutString)^, Length(OutString));
- Result := true;
- finally
- Stream.Free;
- end;
-end;
-
-{*
- Upload a file to KT.
-
- @param FileName Path to upload file
- @param Action Which action to perform with the file (A = Add, C = Checkin)
- @param DocumentId Id of the document
- @return The temporary filename on the server
- @throws EKTWSAPI_Exception Could not access file to upload.
- @throws EKTWSAPI_Exception No response from server.
- @throws EKTWSAPI_Exception Could not upload file.
-*}
-function TKTWSAPI_FolderItem._UploadFile(FileName, Action: WideString;
- DocumentId: Integer): WideString;
-var
- UploadName, UploadStatus, SessionId, StatusCode: WideString;
- PostStream: TIdMultiPartFormDataStream;
- ResponseStream: TStringStream;
- Fields: TStringList;
- HTTP: TIdHTTP;
- UploadData: TPHPValue;
- FilesArr: TPHPArray;
-begin
- Result := '';
- if not FileExists(FileName) then
- raise EKTWSAPI_Exception.Create('Could not access file to upload.');
- // TODO: Check if file is readable
-
- if (DocumentId = 0) then
- UploadName := 'upload_document'
- else
- UploadName := 'upload_'+IntToStr(DocumentId);
- SessionId := FKTAPI.Session;
-
- HTTP := TIdHttp.Create(nil);
- try
- PostStream := TIdMultiPartFormDataStream.Create;
- ResponseStream := TStringStream.Create('');
- Fields := TStringList.Create;
- try
- PostStream.AddFormField('session_id', SessionId);
- PostStream.AddFormField('action', Action);
- PostStream.AddFormField('document_id',IntToStr(DocumentId));
- PostStream.AddFormField(UploadName,'@' + FileName);
- PostStream.AddFile('file',FileName,GetMIMETypeFromFile(FileName));
-
- HTTP.Request.ContentType := PostStream.RequestContentType;
- HTTP.Post(KTUploadURL, PostStream, ResponseStream);
- if (ResponseStream.DataString = '') then
- raise EKTWSAPI_Exception.Create('No response from server.');
- ExtractStrings(['&'], [' '], pAnsiChar(ResponseStream.DataString), Fields);
-
- StatusCode := Copy(Fields[0], Pos('=',Fields[0])+1, 1);
- if (StatusCode <> '0') then
- raise EKTWSAPI_Exception.Create('Could not upload file.');
-
-
- UploadStatus := Copy(Fields[1], Pos('=',Fields[1])+1, Length(Fields[1]));
- UploadStatus := TIdURI.URLDecode(UploadStatus);
- UploadData := TPHPSerialize.Unserialize(TIdURI.URLDecode(UploadStatus));
- Assert(Assigned(UploadData));
- Assert(Assigned(UploadData.AsArray['file']));
- try
- FilesArr := UploadData.AsArray['file'].AsArray;
-
- if (FilesArr['size'].AsString <> _GetFileSize(FileName)) then
- raise EKTWSAPI_Exception.Create('Could not upload file.');
-
- Result := FilesArr['tmp_name'].AsString;
- finally
- UploadData.Free;
- end;
- finally
- PostStream.Free;
- ResponseStream.Free;
- Fields.Free;
- end;
- finally
- HTTP.Free;
- end;
-end;
-
-{*
- Downloads a file from KT.
-
- @param Url Http-url to download
- @param LocalPath Path to save to
- @param FileName FileName to save as
- @return true if success
- @throws EKTWSAPI_Exception Could not create local file
-*}
-function TKTWSAPI_FolderItem._DownloadFile(Url, LocalPath,
- FileName: WideString): Boolean;
-var
- Stream: TMemoryStream;
- LocalFileName: WideString;
- FP: File;
- HTTP: TIdHTTP;
-begin
- LocalFileName := LocalPath + '/' + FileName;
-
- AssignFile(FP, LocalFileName);
- {$I-}
- Rewrite(FP,1);
- {$I+}
- if (IOResult <> 0) then
- raise EKTWSAPI_Exception.Create('Could not create local file');
- CloseFile(FP);
- HTTP := TIdHttp.Create(Nil);
- try
- Stream := TMemoryStream.Create;
- try
- HTTP.Get(Url, Stream);
- Stream.SaveToFile(LocalFileName);
- Result := true;
- finally
- Stream.Free;
- end;
- finally
- HTTP.Free;
- end;
-end;
-
-{*
- Returns a reference to the parent folder.
-
- @return Handle to parent folder
-*}
-function TKTWSAPI_FolderItem.GetParentFolder: TKTWSAPI_Folder;
-begin
- Result := FKTAPI.GetFolderById(FParentId);
-end;
-
-
- { TKTWSAPI_Folder }
-
-{*
- Constructor
-
- @param KTAPI Handle to KTAPI object
- @param FolderDetail Handle to kt_folder_detail
-*}
-constructor TKTWSAPI_Folder.Create(KTAPI: TKTWSAPI;
- FolderDetail: kt_folder_detail);
-begin
- FKTAPI := KTAPI;
- FFolderId := FolderDetail.id;
- FFolderName := FolderDetail.folder_name;
- FParentId := FolderDetail.parent_id;
- FFullPath := FolderDetail.full_path;
-end;
-
-{*
- Returns a reference to a TKTWSAPI_Folder
-
- @param KTAPI Handle to KTAPI object
- @param FolderId Id of folder to fetch
- @return folder handle
- @throws EKTWSAPI_Exception Response message
-*}
-class function TKTWSAPI_Folder.Get(KTAPI: TKTWSAPI;
- FolderId: Integer): TKTWSAPI_Folder;
-var
- FolderDetail: kt_folder_detail;
-begin
- Assert(Assigned(KTAPI));
- Assert(KTAPI.ClassNameIs('TKTWSAPI'));
- Result := nil;
-
- FolderDetail := KTAPI.SoapClient.get_folder_detail(KTAPI.Session, FolderId);
- try
- if (FolderDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(FolderDetail.message_);
-
- Result := TKTWSAPI_Folder.Create(KTAPI, FolderDetail);
-
- finally
- FolderDetail.Free;
- end;
-end;
-
-{*
- Returns the parent folder id.
-
- @return parent folder id
-*}
-function TKTWSAPI_Folder.GetParentFolderId: Integer;
-begin
- Result := FParentId;
-end;
-
-{*
- Returns the folder name.
-
- @return folder name
-*}
-function TKTWSAPI_Folder.GetFolderName: WideString;
-begin
- Result := FFolderName;
-end;
-
-{*
- Returns the current folder id.
-
- @return current folder id
-*}
-function TKTWSAPI_Folder.GetFolderId: Integer;
-begin
- Result := FFolderId;
-end;
-
-{*
- Returns the folder based on foldername.
-
- @param FolderName Name of folder
- @return folder handle
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.GetFolderByName(FolderName: WideString): TKTWSAPI_Folder;
-var
- Path: WideString;
- FolderDetail: kt_folder_detail;
-begin
- Path := FFullPath + '/' + FolderName;
- if (System.Copy(Path, 0, 13) = '/Root Folder/') then
- Path := System.Copy(Path, 13, Length(Path)-1);
- if (System.Copy(Path, 0, 12) = 'Root Folder/') then
- Path := System.Copy(Path, 12, Length(Path)-1);
-
- FolderDetail := FKTAPI.SoapClient.get_folder_detail_by_name(FKTAPI.Session,
- Path);
-
- if (FolderDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(FolderDetail.message_);
-
- Result := TKTWSAPI_Folder.Create(FKTAPI, FolderDetail);
-end;
-
-{*
- Returns the full folder path.
-
- @return Full folder path
-*}
-function TKTWSAPI_Folder.GetFullPath: WideString;
-begin
- Result := FFullPath;
-end;
-
-{*
- Returns the contents of a folder.
-
- @param Depth How many sub-folders to fetch
- @param What to fetch (F=Folders, D=Documents, FD=Both)
- @return folder contents handle
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.GetListing(Depth: Integer;
- What: WideString): kt_folder_contents;
-begin
- Result := FKTAPI.SoapClient.get_folder_contents(
- FKTAPI.Session, FFolderId, Depth, What);
-
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Returns a document based on title.
-
- @param Title Title of document
- @return document handle
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.GetDocumentByName(Title: WideString): TKTWSAPI_Document;
-var
- Path: WideString;
- DocumentDetail: kt_document_detail;
-begin
- Path := FFullPath + '/' + Title;
- if (System.Copy(Path, 0, 13) = '/Root Folder/') then
- Path := System.Copy(Path, 13, Length(Path)-1);
- if (System.Copy(Path, 0, 12) = 'Root Folder/') then
- Path := System.Copy(Path, 12, Length(Path)-1);
-
- DocumentDetail := FKTAPI.SoapClient.get_document_detail_by_name(FKTAPI.Session,
- Path, 'T');
-
- if (DocumentDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(DocumentDetail.message_);
-
- Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail);
-end;
-
-{*
- Returns a document based on filename.
-
- @param FileName Name of file
- @return document handle
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.GetDocumentByFileName(
- FileName: WideString): TKTWSAPI_Document;
-var
- Path: WideString;
- DocumentDetail: kt_document_detail;
-begin
- Result := nil;
- Path := FFullPath + '/' + FileName;
- if (System.Copy(Path, 0, 13) = '/Root Folder/') then
- Path := System.Copy(Path, 13, Length(Path)-1);
- if (System.Copy(Path, 0, 12) = 'Root Folder/') then
- Path := System.Copy(Path, 12, Length(Path)-1);
-
- DocumentDetail := FKTAPI.SoapClient.get_document_detail_by_name(FKTAPI.Session,
- Path, 'F');
- try
- if (DocumentDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(DocumentDetail.message_);
- Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail);
- finally
- DocumentDetail.Free;
- end;
-end;
-
-{*
- Adds a sub folder.
-
- @param FolderName Name of folder
- @return new folder handle
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.AddFolder(FolderName: WideString): TKTWSAPI_Folder;
-var
- FolderDetail: kt_folder_detail;
-begin
- Result := nil;
- FolderDetail := FKTAPI.SoapClient.create_folder(FKTAPI.Session, FFolderId, FolderName);
- try
- if (FolderDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(FolderDetail.message_);
-
- Result := TKTWSAPI_Folder.Create(FKTAPI, FolderDetail);
- finally
- FolderDetail.Free;
- end;
-end;
-
-{*
- Deletes the current folder.
-
- @param Reason Reason for deletetion
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.Delete(Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- // TODO: check why no transaction in folder_transactions
- Result := System.False;
- response := FKTAPI.SoapClient.delete_folder(FKTAPI.Session,
- FFolderId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Renames the current folder.
-
- @param NewName New folder name
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.Rename(NewName: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.rename_folder(FKTAPI.Session,
- FFolderId, NewName);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Moves a folder to another location.
-
- @param TargetFolder Handle to target folder
- @param Reason Reason for move
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.Move(TargetFolder: TKTWSAPI_Folder;
- Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- Assert(Assigned(TargetFolder));
- Assert(TargetFolder.ClassNameIs('TKTWSAPI_Folder'));
-
- response := FKTAPI.SoapClient.move_folder(FKTAPI.Session,
- FFolderId, TargetFolder.GetFolderId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Copies a folder to another location
-
- @param TargetFolder Handle to target folder
- @param Reason Reason for copy
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.Copy(TargetFolder: TKTWSAPI_Folder;
- Reason: WideString): Boolean;
-var
- TargetId: Integer;
- response: kt_response;
-begin
- Result := System.False;
- Assert(Assigned(TargetFolder));
- Assert(TargetFolder.ClassNameIs('TKTWSAPI_Folder'));
-
- TargetId := TargetFolder.GetFolderId;
- response := FKTAPI.SoapClient.copy_folder(FKTAPI.Session,
- FFolderId, TargetId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Adds a document to the current folder.
-
- @param FileName FileName to upload
- @param Title Title to give document
- @param DocumentType Documenttype of document (Default is 'Default')
- @return handle to new document
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.AddDocument(FileName, Title,
- DocumentType: WideString): TKTWSAPI_Document;
-var
- BaseName, TempFileName: WideString;
- DocumentDetail: kt_document_detail;
-begin
- Result := nil;
- BaseName := ExtractFileName(FileName);
- if (Title = '') then
- Title := BaseName;
- if (DocumentType = '') then
- DocumentType := 'Default';
-
- TempFileName := _UploadFile(FileName, 'A');
- DocumentDetail := FKTAPI.FSoapClient.add_document(FKTAPI.Session, FFolderId,
- Title, BaseName, DocumentType, TempFileName);
- try
- if (DocumentDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(DocumentDetail.message_);
-
- Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail);
- finally
- DocumentDetail.Free;
- end;
-end;
-
-{*
- Adds a document to the current folder through web service.
-
- @param FileName FileName to upload
- @param Title Title to give document
- @param DocumentType Documenttype of document (Default is 'Default')
- @return handle to new document
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Folder.AddDocumentBase64(FileName, Title,
- DocumentType: WideString): TKTWSAPI_Document;
-begin
- raise EKTWSAPI_Exception.Create('Not implemented yet!');
-end;
-
-{ TKTWSAPI_Document }
-
-{*
- Constructor
-
- @param KTAPI Handle to KTAPI object
- @param DocumentDetail handle to kt_document_detail
-*}
-constructor TKTWSAPI_Document.Create(KTAPI: TKTWSAPI;
- DocumentDetail: kt_document_detail);
-begin
- FKTAPI := KTAPI;
- FDocumentId := DocumentDetail.document_id;
- FTitle := DocumentDetail.title;
- FDocumentType := DocumentDetail.document_type;
- FVersion := DocumentDetail.version;
- FFilename := DocumentDetail.filename;
- FCreatedDate := DocumentDetail.created_date;
- FCreatedBy := DocumentDetail.created_by;
- FUpdatedDate := DocumentDetail.updated_date;
- FUpdatedBy := DocumentDetail.updated_by;
- FParentId := DocumentDetail.folder_id;
- FWorkflow := DocumentDetail.workflow;
- FWorkflowState := DocumentDetail.workflow_state;
- FCheckoutBy := DocumentDetail.checkout_by;
- FFullPath := DocumentDetail.full_path;
-end;
-
-{*
- Returns a reference to a document.
-
- @param KTAPI Handle to KTAPI object
- @param DocumentId Id of document
- @param LoadInfo Call web service to load document details
- @return handle to document
- @throws EKTWSAPI_Exception Response message
-*}
-class function TKTWSAPI_Document.Get(KTAPI: TKTWSAPI; DocumentId: Integer;
- LoadInfo: Boolean): TKTWSAPI_Document;
-var
- DocumentDetail:kt_document_detail;
-begin
- Assert(Assigned(KTAPI));
- Assert(KTAPI.ClassNameIs('TKTWSAPI'));
- if LoadInfo then
- begin
- DocumentDetail := KTAPI.SoapClient.get_document_detail(KTAPI.Session, DocumentId);
-
- if (DocumentDetail.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(DocumentDetail.message_);
-
- end else
- begin
- DocumentDetail := kt_document_detail.Create;
- DocumentDetail.document_id := DocumentId;
- end;
- try
- Result := TKTWSAPI_Document.Create(KTAPI, DocumentDetail);
- finally
- DocumentDetail.Free;
- end;
-end;
-
-{*
- Checks in a document.
-
- @param FileName Name of file to checkin
- @param Reason Reason for checkin
- @param MajorUpdate Checkin as a major update (bumps major version number)
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Checkin(FileName, Reason: WideString;
- MajorUpdate: Boolean): Boolean;
-var
- BaseName, TempFileName: WideString;
- response: kt_response;
-begin
- Result := System.False;
- BaseName := ExtractFileName(FileName);
-
- TempFileName := _UploadFile(FileName, 'C', FDocumentId);
- response := FKTAPI.SoapClient.checkin_document(FKTAPI.Session, FDocumentId, BaseName, Reason, TempFileName, MajorUpdate);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Checks out a document.
-
- @param Reason Reason for checkout
- @param LocalPath to save downloaded file to
- @param DownloadFile if false then checkout will happen without download
- @return true
- @throws EKTWSAPI_Exception local path does not exist
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Checkout(Reason, LocalPath: WideString;
- DownloadFile: Boolean): Boolean;
-var
- response: kt_response;
- Url: WideString;
-begin
- Result := System.False;
- if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath;
-
- if not DirectoryExists(LocalPath) then
- raise EKTWSAPI_Exception.Create('local path does not exist');
-
- // TODO check if Directory is writable
-
- response := FKTAPI.SoapClient.checkout_document(FKTAPI.Session, FDocumentId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Url := response.message_;
-
- if DownloadFile then
- _DownloadFile(KTWebServerURL+Url, LocalPath, FFileName);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Undo a document checkout
-
- @param Reason Reason for undoing the checkout
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.UndoCheckout(Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.undo_document_checkout(FKTAPI.Session, FDocumentId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Download a version of the document
-
- @param Version Which version of document to download
- @param LocalPath Optional path to save file to
- @param FileName Optional filename to save file as
- @return true
- @throws EKTWSAPI_Exception local path does not exist
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Download(Version, LocalPath, FileName: WideString): Boolean;
-var
- response: kt_response;
- Url: WideString;
-begin
- Result := System.False;
- if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath;
- if (FileName = '') then FileName := FFileName;
-
- if (not DirectoryExists(LocalPath)) then
- raise EKTWSAPI_Exception.Create('local path does not exist');
-
- // TODO: Check if local path is writable
-
- response := FKTAPI.SoapClient.download_document(FKTAPI.Session, FDocumentId);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Url := response.message_;
- Result := _DownloadFile(KTWebServerURL+Url, LocalPath, FileName);
- finally
- response.Free;
- end;
-end;
-
-
-{*
- Download a version of the document through webservice
-
- @param Version Which version of document to download
- @param LocalPath Path to save file to
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.DownloadBase64(Version,
- LocalPath: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath;
- if (FileName = '') then FileName := FFileName;
-
- if (not DirectoryExists(LocalPath)) then
- raise EKTWSAPI_Exception.Create('local path does not exist');
-
- // TODO: Check if local path is writable
-
- response := FKTAPI.SoapClient.download_base64_document(FKTAPI.Session, FDocumentId);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := _SaveBase64StringAsFile(response.message_, LocalPath, FileName);
- finally
- response.Free;
- end;
-end;
-
-{*
- Deletes the current document.
-
- @param Reason Reason for delete
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Delete(Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.delete_document(FKTAPI.Session, FDocumentId, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Changes the owner of the document.
-
- @param UserName Username of new owner
- @param Reason Reason for the owner change
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.ChangeOwner(UserName, Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.change_document_owner(FKTAPI.Session, FDocumentId, UserName, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Copies the current document to the specified folder.
-
- @param Folder Handle to target folder
- @param Reason Reason for copy
- @param NewTitle New title of the file
- @param NewFileName New filename of the file
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Copy(Folder: TKTWSAPI_Folder; Reason, NewTitle,
- NewFileName: WideString): Boolean;
-var
- response: kt_response;
- FolderId: Integer;
-begin
- Result := System.False;
- Assert(Assigned(Folder));
- Assert(Folder.ClassNameIs('TKTWSAPI_Folder'));
- FolderId := Folder.GetFolderId;
-
- response := FKTAPI.SoapClient.copy_document(FKTAPI.Session, FDocumentId, FolderId, Reason, NewTitle, NewFileName);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Moves the current document to the specified folder.
-
- @param Folder Handle to target folder
- @param Reason Reason for move
- @param NewTitle New title of the file
- @param NewFileName New filename of the file
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Move(Folder: TKTWSAPI_Folder; Reason, NewTitle,
- NewFileName: WideString): Boolean;
-var
- response: kt_response;
- FolderId: Integer;
-begin
- Result := System.False;
- Assert(Assigned(Folder));
- Assert(Folder.ClassNameIs('TKTWSAPI_Folder'));
- FolderId := Folder.GetFolderId;
-
- response := FKTAPI.SoapClient.move_document(FKTAPI.Session, FDocumentId, FolderId, Reason, NewTitle, NewFileName);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Changes the document type.
-
- @param DocumentType DocumentType to change to
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.ChangeDocumentType(DocumentType: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.change_document_type(FKTAPI.Session, FDocumentId, DocumentType);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Renames the title of the current document.
-
- @param NewTitle New title of the document
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.RenameTitle(NewTitle: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.rename_document_title(FKTAPI.Session, FDocumentId, NewTitle);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Renames the filename of the current document.
-
- @param NewFilename New filename of the document
- @return true
-*}
-function TKTWSAPI_Document.RenameFilename(NewFilename: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.rename_document_filename(FKTAPI.Session, FDocumentId, NewFilename);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Starts a workflow on the current document.
-
- @param WorkFlow Workflow
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.StartWorkflow(WorkFlow: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.start_document_workflow(FKTAPI.Session, FDocumentId, WorkFlow);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Removes the workflow process from the current document.
-
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.DeleteWorkflow: Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.delete_document_workflow(FKTAPI.Session, FDocumentId);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Performs a transition on the current document.
-
- @param Transition Transition
- @param Reason Reason for transition
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.PeformWorkflowTransition(Transition,
- Reason: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.perform_document_workflow_transition(FKTAPI.Session, FDocumentId, Transition, Reason);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Returns metadata on the document.
-
- @return handle to metadata
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetMetadata: kt_metadata_response;
-begin
- Result := FKTAPI.SoapClient.get_document_metadata(FKTAPI.Session, FDocumentId);
-
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Updates the metadata on the current document.
-
- @param Metadata Handle to metadata
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.UpdateMetadata(
- Metadata: kt_metadata_fieldsets): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.update_document_metadata(FKTAPI.Session, FDocumentId, MetaData);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
-
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Returns the transaction history on the current document.
-
- @return handle to transaction history
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetTransactionHistory: kt_document_transaction_history_response;
-begin
- Result := FKTAPI.SoapClient.get_document_transaction_history(FKTAPI.Session, FDocumentId);
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Returns the version history on the current document.
-
- @return handle to document version history
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetVersionHistory: kt_document_version_history_response;
-begin
- Result := FKTAPI.SoapClient.get_document_version_history(FKTAPI.Session, FDocumentId);
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Returns the links of the current document
-
- @return handle to document version history
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetLinks: kt_linked_document_response;
-begin
- Result := FKTAPI.SoapClient.get_document_links(FKTAPI.Session, FDocumentId);
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Links the current document to a DocumentId
-
- @param DocumentId DocumentId to link to
- @param LinkType Type of link
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Link(DocumentId: Integer;
- const LinkType: WideString): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.link_documents(FKTAPI.Session, FDocumentId,
- DocumentId, LinkType);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Unlinks the current document from a DocumentId
-
- @param DocumentId DocumentId to unlink to
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.Unlink(DocumentId: Integer): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- response := FKTAPI.SoapClient.unlink_documents(FKTAPI.Session, FDocumentId,
- DocumentId);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Checks out a document and downloads document through webservice
-
- @param Reason Reason for checkout
- @param LocalPath to save downloaded file to
- @return true
- @throws EKTWSAPI_Exception local path does not exist
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.CheckoutBase64(Reason,
- LocalPath: WideString; DownloadFile: Boolean): Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
- if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath;
-
- if not DirectoryExists(LocalPath) then
- raise EKTWSAPI_Exception.Create('local path does not exist');
-
- // TODO check if Directory is writable
-
- response := FKTAPI.SoapClient.checkout_base64_document(FKTAPI.Session, FDocumentId, Reason, DownloadFile);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := True;
- if DownloadFile then
- Result := _SaveBase64StringAsFile(response.message_, LocalPath, FFileName);
- finally
- response.Free;
- end;
-end;
-
-{*
- Gets list of document types
-
- @return handle to document types response
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetTypes: kt_document_types_response;
-begin
- Result := FKTAPI.SoapClient.get_document_types(FKTAPI.Session);
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Get list of document link types
- @return handle to document types response
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.GetLinkTypes: kt_document_types_response;
-begin
- Result := FKTAPI.SoapClient.get_document_link_types(FKTAPI.Session);
- if (Result.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(Result.message_);
-end;
-
-{*
- Checks in a document and uploads through webservice
-
- @param FileName Name of file to checkin
- @param Reason Reason for checkin
- @param MajorUpdate Checkin as a major update (bumps major version number)
- @return true
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI_Document.CheckinBase64(FileName, Reason: WideString;
- MajorUpdate: Boolean): Boolean;
-var
- Base64String, BaseName: WideString;
- response: kt_response;
-begin
- Result := System.False;
- Base64String := _LoadFileAsBase64String(FileName);
- BaseName := ExtractFileName(FileName);
-
- response := FKTAPI.SoapClient.checkin_base64_document(FKTAPI.Session,
- FDocumentId, BaseName, Reason, Base64String, MajorUpdate);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{ TKTWSAPI }
-
-{*
- Constructor
-*}
-constructor Tktwsapi.Create();
-begin
- FSoapClient := GetKnowledgeTreePort(False, KTWebServiceUrl);
- FDownloadPath := '';
-end;
-
-{*
- This returns the default location where documents are downloaded in download() and checkout().
-
- @return string
-*}
-function TKTWSAPI.GetDownloadPath: WideString;
-begin
- Result := FDownloadPath;
-end;
-
-{*
- Allows the default location for downloaded documents to be changed.
-
- @param DownloadPath Path to writable folder
- @return true
-*}
-function TKTWSAPI.SetDownloadPath(DownloadPath: WideString): Boolean;
-begin
- if (not DirectoryExists(DownloadPath)) then
- raise EKTWSAPI_Exception.Create('local path is not writable');
- // TODO : Check if folder is writable
-
- FDownloadPath := DownloadPath;
- Result := System.True;
-end;
-
-{*
- Starts an anonymous session.
-
- @param Ip Users Ip-adress
- @return Active session id
-*}
-function TKTWSAPI.StartAnonymousSession(Ip: WideString): WideString;
-begin
- Result := StartSession('anonymous', '', Ip);
-end;
-
-{*
- Starts a user session.
-
- @param Username Users username
- @param Password Users password
- @param Ip Users Ip-adress
- @return Active session id
- @throws EKTWSAPI_Exception KTWSAPI_ERR_SESSION_IN_USE
- @throws EKTWSAPI_Exception Response message
-*}
-function TKTWSAPI.StartSession(Username, Password, Ip: WideString): WideString;
-var
- response: kt_response;
-begin
- if (FSession <> '') then
- raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_IN_USE);
- response := FSoapClient.login(Username, Password, Ip);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- FSession := response.message_;
- Result := FSession;
- finally
- response.Free;
- end;
-end;
-
-{*
- Sets an active session.
-
- @param Session Session id to activate
- @param Ip Users Ip-adress
- @return Active session id
- @throws EKTWSAPI_Exception KTWSAPI_ERR_SESSION_IN_USE
-*}
-function TKTWSAPI.ActiveSession(Session, Ip: WideString): WideString;
-begin
- if (FSession <> '') then
- raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_IN_USE);
- FSession := Session;
- Result := FSession;
-end;
-
-{*
- Closes an active session.
-
- @return true
-*}
-function TKTWSAPI.Logout: Boolean;
-var
- response: kt_response;
-begin
- Result := System.False;
-
- if (FSession = '') then
- raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_NOT_STARTED);
- response := FSoapClient.logout(FSession);
- try
- if (response.status_code <> 0) then
- raise EKTWSAPI_Exception.Create(response.message_);
- FSession := '';
- Result := System.True;
- finally
- response.Free;
- end;
-end;
-
-{*
- Returns a reference to the root folder.
-
- @return handle to folder
-*}
-function TKTWSAPI.GetRootFolder: TKTWSAPI_Folder;
-begin
- Result := GetFolderById(1);
-end;
-
-{*
- Returns a reference to a folder based on id.
-
- @param FolderId Id of folder
- @return handle to folder
-*}
-function TKTWSAPI.GetFolderById(FolderId: Integer): TKTWSAPI_Folder;
-begin
- if FSession = '' then
- raise EKTWSAPI_Exception.Create('A session is not active');
- Result := TKTWSAPI_Folder.Get(Self, FolderId);
-end;
-
-{*
- Returns a reference to a document based on id.
-
- @param DocumentId Id of document
- @return handle to document
-*}
-function TKTWSAPI.GetDocumentById(DocumentId: Integer): TKTWSAPI_Document;
-begin
- if FSession = '' then
- raise EKTWSAPI_Exception.Create('A session is not active');
- Result := TKTWSAPI_Document.Get(Self, DocumentId)
-end;
-
-end.
diff --git a/ktwsapi/delphi/uwebservice.pas b/ktwsapi/delphi/uwebservice.pas
deleted file mode 100644
index 43b8035..0000000
--- a/ktwsapi/delphi/uwebservice.pas
+++ /dev/null
@@ -1,701 +0,0 @@
-{
- Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- i) Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- ii) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}
-
-{*
- Unit auto-generated by delphi's wsdl imported
-
- @Author Bjarte Kalstveit Vebjørnsen
- @Version 1.0 BKV 24.09.2007 Initial revision
-*}
-
-// ************************************************************************ //
-// The types declared in this file were generated from data read from the
-// WSDL File described below:
-// WSDL : http://ktdms.trunk/ktwebservice/webservice.php?wsdl
-// Codegen : [wfDebug,wfGenerateWarnings,wfUseSerializerClassForAttrs]
-// Version : 1.0
-// (23.09.2007 21:20:12 - 1.33.2.6)
-// ************************************************************************ //
-
-unit uwebservice;
-
-interface
-
-uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
-
-type
-
- // ************************************************************************ //
- // The following types, referred to in the WSDL document are not being represented
- // in this file. They are either aliases[@] of other types represented or were referred
- // to but never[!] declared in the document. The types from the latter category
- // typically map to predefined/known XML or Borland types; however, they could also
- // indicate incorrect WSDL documents that failed to declare or import a schema type.
- // ************************************************************************ //
- // !:int - "http://www.w3.org/2001/XMLSchema"
- // !:string - "http://www.w3.org/2001/XMLSchema"
- // !:boolean - "http://www.w3.org/2001/XMLSchema"
-
- kt_response = class; { "urn:KnowledgeTree" }
- kt_folder_detail = class; { "urn:KnowledgeTree" }
- kt_folder_item = class; { "urn:KnowledgeTree" }
- kt_folder_contents = class; { "urn:KnowledgeTree" }
- kt_document_detail = class; { "urn:KnowledgeTree" }
- kt_metadata_selection_item = class; { "urn:KnowledgeTree" }
- kt_metadata_field = class; { "urn:KnowledgeTree" }
- kt_metadata_fieldset = class; { "urn:KnowledgeTree" }
- kt_metadata_response = class; { "urn:KnowledgeTree" }
- kt_document_transitions_response = class; { "urn:KnowledgeTree" }
- kt_document_transaction_history_item = class; { "urn:KnowledgeTree" }
- kt_linked_document = class; { "urn:KnowledgeTree" }
- kt_linked_document_response = class; { "urn:KnowledgeTree" }
- kt_document_transaction_history_response = class; { "urn:KnowledgeTree" }
- kt_document_version_history_item = class; { "urn:KnowledgeTree" }
- kt_document_version_history_response = class; { "urn:KnowledgeTree" }
- kt_document_types_response = class; { "urn:KnowledgeTree" }
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_folder_detail = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fid: Integer;
- Ffolder_name: WideString;
- Fparent_id: Integer;
- Ffull_path: WideString;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property id: Integer read Fid write Fid;
- property folder_name: WideString read Ffolder_name write Ffolder_name;
- property parent_id: Integer read Fparent_id write Fparent_id;
- property full_path: WideString read Ffull_path write Ffull_path;
- end;
-
- kt_folder_items = array of kt_folder_item; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_folder_item = class(TRemotable)
- private
- Fid: Integer;
- Fitem_type: WideString;
- Ftitle: WideString;
- Fcreator: WideString;
- Fchecked_out_by: WideString;
- Fmodified_by: WideString;
- Ffilename: WideString;
- Fsize: WideString;
- Fmajor_version: WideString;
- Fminor_version: WideString;
- Fstorage_path: WideString;
- Fmime_type: WideString;
- Fmime_icon_path: WideString;
- Fmime_display: WideString;
- Fworkflow: WideString;
- Fworkflow_state: WideString;
- Fitems: kt_folder_items;
- public
- destructor Destroy; override;
- published
- property id: Integer read Fid write Fid;
- property item_type: WideString read Fitem_type write Fitem_type;
- property title: WideString read Ftitle write Ftitle;
- property creator: WideString read Fcreator write Fcreator;
- property checked_out_by: WideString read Fchecked_out_by write Fchecked_out_by;
- property modified_by: WideString read Fmodified_by write Fmodified_by;
- property filename: WideString read Ffilename write Ffilename;
- property size: WideString read Fsize write Fsize;
- property major_version: WideString read Fmajor_version write Fmajor_version;
- property minor_version: WideString read Fminor_version write Fminor_version;
- property storage_path: WideString read Fstorage_path write Fstorage_path;
- property mime_type: WideString read Fmime_type write Fmime_type;
- property mime_icon_path: WideString read Fmime_icon_path write Fmime_icon_path;
- property mime_display: WideString read Fmime_display write Fmime_display;
- property workflow: WideString read Fworkflow write Fworkflow;
- property workflow_state: WideString read Fworkflow_state write Fworkflow_state;
- property items: kt_folder_items read Fitems write Fitems;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_folder_contents = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Ffolder_id: Integer;
- Ffolder_name: WideString;
- Ffull_path: WideString;
- Fitems: kt_folder_items;
- public
- destructor Destroy; override;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property folder_id: Integer read Ffolder_id write Ffolder_id;
- property folder_name: WideString read Ffolder_name write Ffolder_name;
- property full_path: WideString read Ffull_path write Ffull_path;
- property items: kt_folder_items read Fitems write Fitems;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_detail = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Ftitle: WideString;
- Fdocument_type: WideString;
- Fversion: WideString;
- Ffilename: WideString;
- Fcreated_date: WideString;
- Fcreated_by: WideString;
- Fupdated_date: WideString;
- Fupdated_by: WideString;
- Fdocument_id: Integer;
- Ffolder_id: Integer;
- Fworkflow: WideString;
- Fworkflow_state: WideString;
- Fcheckout_by: WideString;
- Ffull_path: WideString;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property title: WideString read Ftitle write Ftitle;
- property document_type: WideString read Fdocument_type write Fdocument_type;
- property version: WideString read Fversion write Fversion;
- property filename: WideString read Ffilename write Ffilename;
- property created_date: WideString read Fcreated_date write Fcreated_date;
- property created_by: WideString read Fcreated_by write Fcreated_by;
- property updated_date: WideString read Fupdated_date write Fupdated_date;
- property updated_by: WideString read Fupdated_by write Fupdated_by;
- property document_id: Integer read Fdocument_id write Fdocument_id;
- property folder_id: Integer read Ffolder_id write Ffolder_id;
- property workflow: WideString read Fworkflow write Fworkflow;
- property workflow_state: WideString read Fworkflow_state write Fworkflow_state;
- property checkout_by: WideString read Fcheckout_by write Fcheckout_by;
- property full_path: WideString read Ffull_path write Ffull_path;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_metadata_selection_item = class(TRemotable)
- private
- Fid: Integer;
- Fname_: WideString;
- Fvalue: WideString;
- Fparent_id: Integer;
- published
- property id: Integer read Fid write Fid;
- property name_: WideString read Fname_ write Fname_;
- property value: WideString read Fvalue write Fvalue;
- property parent_id: Integer read Fparent_id write Fparent_id;
- end;
-
- kt_metadata_selection = array of kt_metadata_selection_item; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_metadata_field = class(TRemotable)
- private
- Fname_: WideString;
- Frequired: Boolean;
- Fvalue: WideString;
- Fdescription: WideString;
- Fcontrol_type: WideString;
- Fselection: kt_metadata_selection;
- public
- destructor Destroy; override;
- published
- property name_: WideString read Fname_ write Fname_;
- property required: Boolean read Frequired write Frequired;
- property value: WideString read Fvalue write Fvalue;
- property description: WideString read Fdescription write Fdescription;
- property control_type: WideString read Fcontrol_type write Fcontrol_type;
- property selection: kt_metadata_selection read Fselection write Fselection;
- end;
-
- kt_metadata_fields = array of kt_metadata_field; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_metadata_fieldset = class(TRemotable)
- private
- Ffieldset: WideString;
- Fdescription: WideString;
- Ffields: kt_metadata_fields;
- public
- destructor Destroy; override;
- published
- property fieldset: WideString read Ffieldset write Ffieldset;
- property description: WideString read Fdescription write Fdescription;
- property fields: kt_metadata_fields read Ffields write Ffields;
- end;
-
- kt_metadata_fieldsets = array of kt_metadata_fieldset; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_metadata_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fmetadata: kt_metadata_fieldsets;
- public
- destructor Destroy; override;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property metadata: kt_metadata_fieldsets read Fmetadata write Fmetadata;
- end;
-
- kt_document_transitions = array of WideString; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_transitions_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fmetadata: kt_document_transitions;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property metadata: kt_document_transitions read Fmetadata write Fmetadata;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_transaction_history_item = class(TRemotable)
- private
- Ftransaction_name: WideString;
- Fusername: WideString;
- Fversion: WideString;
- Fcomment: WideString;
- Fdatetime: WideString;
- published
- property transaction_name: WideString read Ftransaction_name write Ftransaction_name;
- property username: WideString read Fusername write Fusername;
- property version: WideString read Fversion write Fversion;
- property comment: WideString read Fcomment write Fcomment;
- property datetime: WideString read Fdatetime write Fdatetime;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_linked_document = class(TRemotable)
- private
- Fdocument_id: Integer;
- Ftitle: WideString;
- Fsize: Integer;
- Fworkflow: WideString;
- Fworkflow_state: WideString;
- Flink_type: WideString;
- published
- property document_id: Integer read Fdocument_id write Fdocument_id;
- property title: WideString read Ftitle write Ftitle;
- property size: Integer read Fsize write Fsize;
- property workflow: WideString read Fworkflow write Fworkflow;
- property workflow_state: WideString read Fworkflow_state write Fworkflow_state;
- property link_type: WideString read Flink_type write Flink_type;
- end;
-
- kt_linked_documents = array of kt_linked_document; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_linked_document_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fparent_document_id: WideString;
- Flinks: kt_linked_documents;
- public
- destructor Destroy; override;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property parent_document_id: WideString read Fparent_document_id write Fparent_document_id;
- property links: kt_linked_documents read Flinks write Flinks;
- end;
-
- kt_document_transaction_history = array of kt_document_transaction_history_item; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_transaction_history_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fhistory: kt_document_transaction_history;
- public
- destructor Destroy; override;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property history: kt_document_transaction_history read Fhistory write Fhistory;
- end;
-
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_version_history_item = class(TRemotable)
- private
- Fuser: Integer;
- Fmetadata_version: WideString;
- Fcontent_version: WideString;
- published
- property user: Integer read Fuser write Fuser;
- property metadata_version: WideString read Fmetadata_version write Fmetadata_version;
- property content_version: WideString read Fcontent_version write Fcontent_version;
- end;
-
- kt_document_version_history = array of kt_document_version_history_item; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_version_history_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fhistory: kt_document_version_history;
- public
- destructor Destroy; override;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property history: kt_document_version_history read Fhistory write Fhistory;
- end;
-
- kt_document_types_array = array of WideString; { "urn:KnowledgeTree" }
-
-
- // ************************************************************************ //
- // Namespace : urn:KnowledgeTree
- // ************************************************************************ //
- kt_document_types_response = class(TRemotable)
- private
- Fstatus_code: Integer;
- Fmessage_: WideString;
- Fdocument_types: kt_document_types_array;
- published
- property status_code: Integer read Fstatus_code write Fstatus_code;
- property message_: WideString read Fmessage_ write Fmessage_;
- property document_types: kt_document_types_array read Fdocument_types write Fdocument_types;
- end;
-
-
- // ************************************************************************ //
- // Namespace : http://schemas.xmlsoap.org/soap/envelope/
- // soapAction: http://schemas.xmlsoap.org/soap/envelope/#KTWebService#%operationName%
- // transport : http://schemas.xmlsoap.org/soap/http
- // style : rpc
- // binding : KnowledgeTreeBinding
- // service : KnowledgeTreeService
- // port : KnowledgeTreePort
- // URL : http://ktdms.trunk/ktwebservice/webservice.php
- // ************************************************************************ //
- KnowledgeTreePort = interface(IInvokable)
- ['{FA35CA60-1DC3-B3C7-6C65-BE4E3A6A8A22}']
- function login(const username: WideString; const password: WideString; const ip: WideString): kt_response; stdcall;
- function anonymous_login(const ip: WideString): kt_response; stdcall;
- function logout(const session_id: WideString): kt_response; stdcall;
- function get_folder_detail(const session_id: WideString; const folder_id: Integer): kt_folder_detail; stdcall;
- function get_folder_detail_by_name(const session_id: WideString; const folder_name: WideString): kt_folder_detail; stdcall;
- function get_folder_contents(const session_id: WideString; const folder_id: Integer; const depth: Integer; const what: WideString): kt_folder_contents; stdcall;
- function create_folder(const session_id: WideString; const folder_id: Integer; const folder_name: WideString): kt_folder_detail; stdcall;
- function delete_folder(const session_id: WideString; const folder_id: Integer; const reason: WideString): kt_response; stdcall;
- function rename_folder(const session_id: WideString; const folder_id: Integer; const newname: WideString): kt_response; stdcall;
- function get_document_links(const session_id: WideString; const document_id: Integer): kt_linked_document_response; stdcall;
- function link_documents(const session_id: WideString; const parent_document_id: Integer; const child_document_id: Integer; const type_: WideString): kt_response; stdcall;
- function unlink_documents(const session_id: WideString; const parent_document_id: Integer; const child_document_id: Integer): kt_response; stdcall;
- function copy_folder(const session_id: WideString; const source_id: Integer; const target_id: Integer; const reason: WideString): kt_response; stdcall;
- function move_folder(const session_id: WideString; const source_id: Integer; const target_id: Integer; const reason: WideString): kt_response; stdcall;
- function get_document_detail(const session_id: WideString; const document_id: Integer): kt_document_detail; stdcall;
- function checkin_document(const session_id: WideString; const document_id: Integer; const filename: WideString; const reason: WideString; const tempfilename: WideString; const major_update: Boolean): kt_response; stdcall;
- function checkin_small_document(const session_id: WideString; const document_id: Integer; const filename: WideString; const reason: WideString; const base64: WideString; const major_update: Boolean): kt_response; stdcall;
- function checkin_base64_document(const session_id: WideString; const document_id: Integer; const filename: WideString; const reason: WideString; const base64: WideString; const major_update: Boolean): kt_response; stdcall;
- function add_document(const session_id: WideString; const folder_id: Integer; const title: WideString; const filename: WideString; const documentype: WideString; const tempfilename: WideString): kt_document_detail; stdcall;
- function add_small_document(const session_id: WideString; const folder_id: Integer; const title: WideString; const filename: WideString; const documentype: WideString; const base64: WideString): kt_document_detail; stdcall;
- function add_base64_document(const session_id: WideString; const folder_id: Integer; const title: WideString; const filename: WideString; const documentype: WideString; const base64: WideString): kt_document_detail; stdcall;
- function get_document_detail_by_name(const session_id: WideString; const document_name: WideString; const what: WideString): kt_document_detail; stdcall;
- function checkout_document(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall;
- function checkout_small_document(const session_id: WideString; const document_id: Integer; const reason: WideString; const download: Boolean): kt_response; stdcall;
- function checkout_base64_document(const session_id: WideString; const document_id: Integer; const reason: WideString; const download: Boolean): kt_response; stdcall;
- function undo_document_checkout(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall;
- function download_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall;
- function download_small_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall;
- function download_base64_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall;
- function delete_document(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall;
- function change_document_owner(const session_id: WideString; const document_id: Integer; const username: WideString; const reason: WideString): kt_response; stdcall;
- function copy_document(const session_id: WideString; const document_id: Integer; const folder_id: Integer; const reason: WideString; const newtitle: WideString; const newfilename: WideString): kt_response; stdcall;
- function move_document(const session_id: WideString; const document_id: Integer; const folder_id: Integer; const reason: WideString; const newtitle: WideString; const newfilename: WideString): kt_response; stdcall;
- function rename_document_title(const session_id: WideString; const document_id: Integer; const newtitle: WideString): kt_response; stdcall;
- function rename_document_filename(const session_id: WideString; const document_id: Integer; const newfilename: WideString): kt_response; stdcall;
- function change_document_type(const session_id: WideString; const document_id: Integer; const documenttype: WideString): kt_response; stdcall;
- function start_document_workflow(const session_id: WideString; const document_id: Integer; const workflow: WideString): kt_response; stdcall;
- function delete_document_workflow(const session_id: WideString; const document_id: Integer): kt_response; stdcall;
- function perform_document_workflow_transition(const session_id: WideString; const document_id: Integer; const transition: WideString; const reason: WideString): kt_response; stdcall;
- function get_document_metadata(const session_id: WideString; const document_id: Integer): kt_metadata_response; stdcall;
- function get_document_type_metadata(const session_id: WideString; const document_type: WideString): kt_metadata_response; stdcall;
- function update_document_metadata(const session_id: WideString; const document_id: Integer; const metadata: kt_metadata_fieldsets): kt_response; stdcall;
- function get_document_workflow_transitions(const session_id: WideString; const document_id: Integer): kt_document_transitions_response; stdcall;
- function get_document_workflow_state(const session_id: WideString; const document_id: Integer): kt_response; stdcall;
- function get_document_transaction_history(const session_id: WideString; const document_id: Integer): kt_document_transaction_history_response; stdcall;
- function get_document_version_history(const session_id: WideString; const document_id: Integer): kt_document_version_history_response; stdcall;
- function get_document_types(const session_id: WideString): kt_document_types_response; stdcall;
- function get_document_link_types(const session_id: WideString): kt_document_types_response; stdcall;
- end;
-
-function GetKnowledgeTreePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): KnowledgeTreePort;
-
-
-implementation
-
-function GetKnowledgeTreePort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): KnowledgeTreePort;
-const
- defWSDL = 'http://ktdms.trunk/ktwebservice/webservice.php?wsdl';
- defURL = 'http://ktdms.trunk/ktwebservice/webservice.php';
- defSvc = 'KnowledgeTreeService';
- defPrt = 'KnowledgeTreePort';
-var
- RIO: THTTPRIO;
-begin
- Result := nil;
- if (Addr = '') then
- begin
- if UseWSDL then
- Addr := defWSDL
- else
- Addr := defURL;
- end;
- if HTTPRIO = nil then
- RIO := THTTPRIO.Create(nil)
- else
- RIO := HTTPRIO;
- try
- Result := (RIO as KnowledgeTreePort);
- if UseWSDL then
- begin
- RIO.WSDLLocation := Addr;
- RIO.Service := defSvc;
- RIO.Port := defPrt;
- end else
- RIO.URL := Addr;
- finally
- if (Result = nil) and (HTTPRIO = nil) then
- RIO.Free;
- end;
-end;
-
-
-destructor kt_folder_item.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fitems)-1 do
- if Assigned(Fitems[I]) then
- Fitems[I].Free;
- SetLength(Fitems, 0);
- inherited Destroy;
-end;
-
-destructor kt_folder_contents.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fitems)-1 do
- if Assigned(Fitems[I]) then
- Fitems[I].Free;
- SetLength(Fitems, 0);
- inherited Destroy;
-end;
-
-destructor kt_metadata_field.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fselection)-1 do
- if Assigned(Fselection[I]) then
- Fselection[I].Free;
- SetLength(Fselection, 0);
- inherited Destroy;
-end;
-
-destructor kt_metadata_fieldset.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Ffields)-1 do
- if Assigned(Ffields[I]) then
- Ffields[I].Free;
- SetLength(Ffields, 0);
- inherited Destroy;
-end;
-
-destructor kt_metadata_response.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fmetadata)-1 do
- if Assigned(Fmetadata[I]) then
- Fmetadata[I].Free;
- SetLength(Fmetadata, 0);
- inherited Destroy;
-end;
-
-destructor kt_linked_document_response.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Flinks)-1 do
- if Assigned(Flinks[I]) then
- Flinks[I].Free;
- SetLength(Flinks, 0);
- inherited Destroy;
-end;
-
-destructor kt_document_transaction_history_response.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fhistory)-1 do
- if Assigned(Fhistory[I]) then
- Fhistory[I].Free;
- SetLength(Fhistory, 0);
- inherited Destroy;
-end;
-
-destructor kt_document_version_history_response.Destroy;
-var
- I: Integer;
-begin
- for I := 0 to Length(Fhistory)-1 do
- if Assigned(Fhistory[I]) then
- Fhistory[I].Free;
- SetLength(Fhistory, 0);
- inherited Destroy;
-end;
-
-initialization
- InvRegistry.RegisterInterface(TypeInfo(KnowledgeTreePort), 'http://schemas.xmlsoap.org/soap/envelope/', '');
- InvRegistry.RegisterDefaultSOAPAction(TypeInfo(KnowledgeTreePort), 'http://schemas.xmlsoap.org/soap/envelope/#KTWebService#%operationName%');
- InvRegistry.RegisterExternalParamName(TypeInfo(KnowledgeTreePort), 'link_documents', 'type_', 'type');
- RemClassRegistry.RegisterXSClass(kt_response, 'urn:KnowledgeTree', 'kt_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_response), 'message_', 'message');
- RemClassRegistry.RegisterXSClass(kt_folder_detail, 'urn:KnowledgeTree', 'kt_folder_detail');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_folder_detail), 'message_', 'message');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_folder_items), 'urn:KnowledgeTree', 'kt_folder_items');
- RemClassRegistry.RegisterXSClass(kt_folder_item, 'urn:KnowledgeTree', 'kt_folder_item');
- RemClassRegistry.RegisterXSClass(kt_folder_contents, 'urn:KnowledgeTree', 'kt_folder_contents');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_folder_contents), 'message_', 'message');
- RemClassRegistry.RegisterXSClass(kt_document_detail, 'urn:KnowledgeTree', 'kt_document_detail');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_detail), 'message_', 'message');
- RemClassRegistry.RegisterXSClass(kt_metadata_selection_item, 'urn:KnowledgeTree', 'kt_metadata_selection_item');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_selection_item), 'name_', 'name');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_selection), 'urn:KnowledgeTree', 'kt_metadata_selection');
- RemClassRegistry.RegisterXSClass(kt_metadata_field, 'urn:KnowledgeTree', 'kt_metadata_field');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_field), 'name_', 'name');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_fields), 'urn:KnowledgeTree', 'kt_metadata_fields');
- RemClassRegistry.RegisterXSClass(kt_metadata_fieldset, 'urn:KnowledgeTree', 'kt_metadata_fieldset');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_fieldsets), 'urn:KnowledgeTree', 'kt_metadata_fieldsets');
- RemClassRegistry.RegisterXSClass(kt_metadata_response, 'urn:KnowledgeTree', 'kt_metadata_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_response), 'message_', 'message');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_transitions), 'urn:KnowledgeTree', 'kt_document_transitions');
- RemClassRegistry.RegisterXSClass(kt_document_transitions_response, 'urn:KnowledgeTree', 'kt_document_transitions_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_transitions_response), 'message_', 'message');
- RemClassRegistry.RegisterXSClass(kt_document_transaction_history_item, 'urn:KnowledgeTree', 'kt_document_transaction_history_item');
- RemClassRegistry.RegisterXSClass(kt_linked_document, 'urn:KnowledgeTree', 'kt_linked_document');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_linked_documents), 'urn:KnowledgeTree', 'kt_linked_documents');
- RemClassRegistry.RegisterXSClass(kt_linked_document_response, 'urn:KnowledgeTree', 'kt_linked_document_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_linked_document_response), 'message_', 'message');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_transaction_history), 'urn:KnowledgeTree', 'kt_document_transaction_history');
- RemClassRegistry.RegisterXSClass(kt_document_transaction_history_response, 'urn:KnowledgeTree', 'kt_document_transaction_history_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_transaction_history_response), 'message_', 'message');
- RemClassRegistry.RegisterXSClass(kt_document_version_history_item, 'urn:KnowledgeTree', 'kt_document_version_history_item');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_version_history), 'urn:KnowledgeTree', 'kt_document_version_history');
- RemClassRegistry.RegisterXSClass(kt_document_version_history_response, 'urn:KnowledgeTree', 'kt_document_version_history_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_version_history_response), 'message_', 'message');
- RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_types_array), 'urn:KnowledgeTree', 'kt_document_types_array');
- RemClassRegistry.RegisterXSClass(kt_document_types_response, 'urn:KnowledgeTree', 'kt_document_types_response');
- RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_types_response), 'message_', 'message');
-
-end.
diff --git a/ktwsapi/dotnet/TODO.txt b/ktwsapi/dotnet/TODO.txt
deleted file mode 100644
index e69de29..0000000
--- a/ktwsapi/dotnet/TODO.txt
+++ /dev/null
diff --git a/ktwsapi/java/TODO.txt b/ktwsapi/java/TODO.txt
deleted file mode 100644
index e69de29..0000000
--- a/ktwsapi/java/TODO.txt
+++ /dev/null
diff --git a/ktwsapi/php/docs/INSTALL.txt b/ktwsapi/php/docs/INSTALL.txt
deleted file mode 100644
index 6bd1c2e..0000000
--- a/ktwsapi/php/docs/INSTALL.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-KnowledgeTree Web Server Object Model - PHP Edition
-===================================================
-
-The KTWSAPI PHP edition implements the object model wrapping the web services. It can thus be deployed on
-a remote machine independant of the actual KnowledgeTree installation.
-
-Dependencies
-============
-1) libcurl
-2) PEAR::SOAP
-
-Installation
-============
-
-Copy the ktwsapi/php folder to some location in your project.
-
-Update ktwsapi_cfg.inc.php with the appropriate settings for your system.
-
-Examples
-========
-
-There are some examples in the ktwsapi/php/examples folder.
-
diff --git a/ktwsapi/php/examples/ktws_eg_add_document.php b/ktwsapi/php/examples/ktws_eg_add_document.php
deleted file mode 100644
index 2650304..0000000
--- a/ktwsapi/php/examples/ktws_eg_add_document.php
+++ /dev/null
@@ -1,53 +0,0 @@
-start_session('admin','admin');
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-$root = $ktapi->get_root_folder();
-
-$root->add_document('c:/temp/test.doc');
-
-$ktapi->logout();
-
-?>
diff --git a/ktwsapi/php/examples/ktws_eg_anonymous.php b/ktwsapi/php/examples/ktws_eg_anonymous.php
deleted file mode 100644
index 40060d4..0000000
--- a/ktwsapi/php/examples/ktws_eg_anonymous.php
+++ /dev/null
@@ -1,56 +0,0 @@
-start_anonymous_session();
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-// do something
-
-$root=$ktapi->get_root_folder();
-
-// when done, logout
-
-
-$ktapi->logout();
-
-?>
diff --git a/ktwsapi/php/examples/ktws_eg_checkin.php b/ktwsapi/php/examples/ktws_eg_checkin.php
deleted file mode 100644
index 831a1be..0000000
--- a/ktwsapi/php/examples/ktws_eg_checkin.php
+++ /dev/null
@@ -1,79 +0,0 @@
-active_session('sj5827sohdoj6h3nvifrcsa1f2');
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-$root = $ktapi->get_root_folder();
-if (PEAR::isError($root))
-{
- print $root->getMessage();
- exit;
-}
-
-$document = $root->add_document('c:/temp/test.doc');
-if (PEAR::isError($document))
-{
- print $document->getMessage();
- exit;
-}
-
-$result = $document->checkout('going to update','c:/');
-if (PEAR::isError($result))
-{
- print $result->getMessage();
- exit;
-}
-
-$result = $document->checkin('c:/test.doc','have updated',false);
-if (PEAR::isError($result))
-{
- print $result->getMessage();
- exit;
-}
-
-$ktapi->logout();
-
-?>
diff --git a/ktwsapi/php/examples/ktws_eg_create_folder.php b/ktwsapi/php/examples/ktws_eg_create_folder.php
deleted file mode 100644
index ec68b99..0000000
--- a/ktwsapi/php/examples/ktws_eg_create_folder.php
+++ /dev/null
@@ -1,70 +0,0 @@
-active_session('qekolkpkk9mq2nlc31ghndi1l2');
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-$root = $ktapi->get_root_folder();
-if (PEAR::isError($root))
-{
- print $root->getMessage();
- exit;
-}
-
-$folder = $root->add_folder('test folder');
-if (PEAR::isError($folder))
-{
- print $folder->getMessage();
- exit;
-}
-
-$subfolder = $folder->add_folder('test sub folder');
-if (PEAR::isError($subfolder))
-{
- print $subfolder->getMessage();
- exit;
-}
-
-?>
diff --git a/ktwsapi/php/examples/ktws_eg_doc_info.php b/ktwsapi/php/examples/ktws_eg_doc_info.php
deleted file mode 100644
index bb24454..0000000
--- a/ktwsapi/php/examples/ktws_eg_doc_info.php
+++ /dev/null
@@ -1,68 +0,0 @@
-active_session('sj5827sohdoj6h3nvifrcsa1f2');
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-// lets ge the document based on id.
-
-$document = $ktapi->get_document_by_id(50);
-if (PEAR::isError($document))
-{
- print $document->getMessage();
- exit;
-}
-
-// lets get the document metadata
-
-$metadata = $document->get_metadata();
-if (PEAR::isError($metadata))
-{
- print $metadata->getMessage();
- exit;
-}
-var_dump($metadata);
-
-?>
diff --git a/ktwsapi/php/examples/ktws_eg_folder_listing.php b/ktwsapi/php/examples/ktws_eg_folder_listing.php
deleted file mode 100644
index 02ab790..0000000
--- a/ktwsapi/php/examples/ktws_eg_folder_listing.php
+++ /dev/null
@@ -1,74 +0,0 @@
-active_session('sj5827sohdoj6h3nvifrcsa1f2');
-if (PEAR::isError($response))
-{
- print $response->getMessage();
- exit;
-}
-
-$root = $ktapi->get_root_folder();
-if (PEAR::isError($root))
-{
- print $root->getMessage();
- exit;
-}
-
-$listing = $root->get_listing();
-if (PEAR::isError($listing))
-{
- print $listing->getMessage();
- exit;
-}
-
-// lets display the items
-
-foreach($listing as $folderitem)
-{
- $title = $folderitem->title;
- $item_type = $folderitem->item_type;
- $mime_display = $folderitem->mime_display;
-
- print "$title $item_type $mime_display\n";
-}
-
-?>
diff --git a/ktwsapi/php/ktwsapi.inc.php b/ktwsapi/php/ktwsapi.inc.php
deleted file mode 100644
index 2dfb90f..0000000
--- a/ktwsapi/php/ktwsapi.inc.php
+++ /dev/null
@@ -1,1309 +0,0 @@
-ktapi->session;
-
- $ch = curl_init();
- $fp = fopen ($filename, 'r');
- curl_setopt($ch, CURLOPT_URL, KTUploadURL);
- curl_setopt($ch, CURLOPT_POST, 1);
-
- $post_fields = array(
- 'session_id'=>$session_id,
- 'action'=>$action,
- 'document_id'=>$document_id,
- $uploadname=>'@' . $filename
-
- );
-
- $str = serialize($post_fields);
-
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- $response = curl_exec ($ch);
- curl_close ($ch);
-
- if ($response == '')
- {
- return new PEAR_Error('No response from server.');
- }
-
- $fields=explode('&',$response);
- $status_code=-1;
- $msg='*not set*';
- $upload_status='';
-
-
- foreach($fields as $field)
- {
- list($fieldname, $value) = explode('=', $field);
-
- $$fieldname = $value;
- }
-
- if ($status_code == 0)
- {
- $upload_status= unserialize(urldecode($upload_status));
-
- if ($upload_status[$uploadname]['size'] == filesize($filename))
- {
- return $upload_status[$uploadname]['tmp_name'];
- }
- }
- return new PEAR_Error('Could not upload file.');
-
- }
-
- /**
- * Downlaods a file from KT.
- *
- * @param string $url
- * @param string $localpath
- * @param string $filename
- * @return boolean
- */
- function _download_file($url, $localpath, $filename)
- {
- $localfilename = $localpath . '/' . $filename;
-
- $fp = fopen($localfilename,'wb');
- if ($fp == null)
- {
- return new PEAR_Error('Could not create local file');
- }
-
- $ch = curl_init();
-
- curl_setopt($ch, CURLOPT_FILE, $fp);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_URL, $url);
-
- $response = curl_exec($ch);
- if ($response == false)
- {
- $response = new PEAR_Error(curl_error($ch));
- }
- else
- {
- $response = true;
- }
- curl_close($ch);
-
- fclose($fp);
-
- return $response;
- }
-
- /**
- * Returns a reference to the parent folder.
- *
- * @return KTWSAPI_Folder
- */
- function &get_parent_folder()
- {
- $parent = &KTAPI::get_folder_by_id($this->parent_id);
- return $parent;
- }
-
-}
-
-class KTWSAPI_Folder extends KTWSAPI_FolderItem
-{
- var $folder_name;
- var $full_path;
- var $folder_id;
-
- /**
- * Constructor
- *
- * @param KTWSAPI $ktapi
- * @param kt_folder_detail $kt_folder_detail
- * @return KTWSAPI_Folder
- */
- function KTWSAPI_Folder(&$ktapi, $kt_folder_detail)
- {
- $this->ktapi = &$ktapi;
- $this->folder_id = $kt_folder_detail->id+0;
- $this->folder_name = $kt_folder_detail->folder_name;
- $this->parent_id = $kt_folder_detail->parent_id+0;
- $this->full_path = $kt_folder_detail->full_path;
- }
-
- /**
- * Returns a reference to a KTWSAPI_Folder
- *
- * @param KTWSAPI $ktapi
- * @param int $folderid
- * @return KTWSAPI_Folder
- */
- function &get(&$ktapi, $folderid)
- {
- assert(!is_null($ktapi));
- assert(is_a($ktapi, 'KTWSAPI'));
- assert(is_numeric($folderid));
-
- $folderid += 0;
-
- $kt_folder_detail = $ktapi->soapclient->get_folder_detail($ktapi->session, $folderid);
- if (SOAP_Client::isError($kt_folder_detail))
- {
- return $kt_folder_detail;
- }
-
- if ($kt_folder_detail->status_code != 0)
- {
- return new PEAR_Error($kt_folder_detail->message);
- }
-
- $folder = & new KTWSAPI_Folder($ktapi, $kt_folder_detail);
-
- return $folder;
- }
-
- /**
- * Returnss the parent folder id.
- *
- * @return int
- */
- function get_parent_folder_id()
- {
- return $this->parent_id;
- }
-
- /**
- * Returns the folder name.
- *
- * @return string
- */
- function get_folder_name()
- {
- return $this->folder_name;
- }
-
- /**
- * Returns the current folder id.
- *
- * @return int
- */
- function get_folderid()
- {
- return $this->folder_id;
- }
-
- /**
- * Returns the foldre based on foldername.
- *
- * @param string $foldername
- * @return KTWSAPI_Folder
- */
- function &get_folder_by_name($foldername)
- {
- $path = $this->full_path . '/' . $foldername;
- if (substr($path,0,13) == '/Root Folder/')
- {
- $path = substr($path,13);
- }
- if (substr($path,0,12) == 'Root Folder/')
- {
- $path = substr($path,12);
- }
-
- $kt_folder_detail = $this->ktapi->soapclient->get_folder_detail_by_name($this->ktapi->session, $path);
-
- if (SOAP_Client::isError($kt_folder_detail))
- {
- return $kt_folder_detail;
- }
-
- if ($kt_folder_detail->status_code != 0)
- {
- return new PEAR_Error($kt_folder_detail->message);
- }
-
- $folder= & new KTWSAPI_Folder($this->ktapi, $kt_folder_detail);
- return $folder;
- }
-
- /**
- * Returns the full folder path.
- *
- * @return string
- */
- function get_full_path()
- {
- return $this->full_path;
- }
-
- /**
- * Returns the contents of a folder.
- *
- * @param int $depth
- * @param string $what
- * @return kt_folder_items
- */
- function get_listing($depth=1, $what='DF')
- {
- $kt_folder_contents = $this->ktapi->soapclient->get_folder_contents($this->ktapi->session, $this->folder_id, $depth+0, $what);
- if (SOAP_Client::isError($kt_folder_contents))
- {
- return $kt_folder_contents;
- }
-
- if ($kt_folder_contents->status_code != 0)
- {
- return new PEAR_Error($kt_folder_contents->message);
- }
-
- return $kt_folder_contents->items;
- }
-
- /**
- * Returns a document based on title.
- *
- * @param string $title
- * @return KTWSAPI_Document
- */
- function &get_document_by_name($title)
- {
- $path = $this->full_path . '/' . $title;
- if (substr($path,0,13) == '/Root Folder/')
- {
- $path = substr($path,13);
- }
- if (substr($path,0,12) == 'Root Folder/')
- {
- $path = substr($path,12);
- }
-
- $kt_document_detail = $this->ktapi->soapclient->get_document_detail_by_name($this->ktapi->session, $path, 'T');
-
- if (SOAP_Client::isError($kt_document_detail))
- {
- return $kt_document_detail;
- }
-
- if ($kt_document_detail->status_code != 0)
- {
- return new PEAR_Error($kt_document_detail->message);
- }
-
- $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail);
-
- return $document;
- }
-
- /**
- * Returns a document based on filename.
- *
- * @param string $filename
- * @return KTWSAPI_Document
- */
- function &get_document_by_filename($filename)
- {
- $path = $this->full_path . '/' . $filename;
- if (substr($path,0,13) == '/Root Folder/')
- {
- $path = substr($path,13);
- }
- if (substr($path,0,12) == 'Root Folder/')
- {
- $path = substr($path,12);
- }
-
- $kt_document_detail = $this->ktapi->soapclient->get_document_detail_by_name($this->ktapi->session, $path, 'F');
-
- if (SOAP_Client::isError($kt_document_detail))
- {
- return $kt_document_detail;
- }
-
- if ($kt_document_detail->status_code != 0)
- {
- return new PEAR_Error($kt_document_detail->message);
- }
-
- $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail);
- return $document;
- }
-
-
- /**
- * Adds a sub folder.
- *
- * @param string $foldername
- * @return KTWSAPI_Folder
- */
- function &add_folder($foldername)
- {
- $kt_folder_detail = $this->ktapi->soapclient->create_folder($this->ktapi->session, $this->folder_id, $foldername);
- if (SOAP_Client::isError($kt_folder_detail))
- {
- return $kt_folder_detail;
- }
-
- if ($kt_folder_detail->status_code != 0)
- {
- return new PEAR_Error($kt_folder_detail->message);
- }
-
- $folder = &new KTWSAPI_Folder($this->ktapi, $kt_folder_detail);
-
- return $folder;
- }
-
- /**
- * Deletes the current folder.
- *
- * @param string $reason
- * @return true
- */
- function delete($reason)
- {
- // TODO: check why no transaction in folder_transactions
- $kt_response = $this->ktapi->soapclient->delete_folder($this->ktapi->session, $this->folder_id, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Renames the current folder.
- *
- * @param string $newname
- * @return true
- */
- function rename($newname)
- {
- $kt_response = $this->ktapi->soapclient->rename_folder($this->ktapi->session, $this->folder_id, $newname);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Moves a folder to another location.
- *
- * @param KTWSAPI_Folder $ktwsapi_target_folder
- * @param string $reason
- * @return true
- */
- function move(&$ktwsapi_target_folder, $reason='')
- {
- assert(!is_null($ktwsapi_target_folder));
- assert(is_a($ktwsapi_target_folder,'KTWSAPI_Folder'));
-
- $kt_response = $this->ktapi->soapclient->move_folder($this->ktapi->session, $this->folder_id,$ktwsapi_target_folder->get_folderid());
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Copies a folder to another location
- *
- * @param KTWSAPI_Folder $ktwsapi_target_folder
- * @param string $reason
- * @return true
- */
- function copy(&$ktwsapi_target_folder, $reason='')
- {
- assert(!is_null($ktwsapi_target_folder));
- assert(is_a($ktwsapi_target_folder,'KTWSAPI_Folder'));
-
- $targetid=$ktwsapi_target_folder->get_folderid();
-
- $kt_response = $this->ktapi->soapclient->copy_folder($this->ktapi->session, $this->folder_id,$targetid, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Adds a document to the current folder.
- *
- * @param string $filename
- * @param string $title
- * @param string $documenttype
- * @return KTWSAPI_Document
- */
- function &add_document($filename, $title=null, $documenttype=null)
- {
- if (empty($title))
- {
- $title=basename($filename);
- }
- $basename=basename($filename);
-
- if (empty($documenttype))
- {
- $documenttype='Default';
- }
-
- // First step - upload file
- $tempfilename = $this->_upload_file($filename,'A');
- if (PEAR::isError($tempfilename))
- {
- return new PEAR_Error($tempfilename->message);
- }
-
- // Second step - move file into KT
- $kt_document_detail = $this->ktapi->soapclient->add_document($this->ktapi->session, $this->folder_id, $title, $basename, $documenttype, $tempfilename );
- if (SOAP_Client::isError($kt_document_detail))
- {
- return $kt_document_detail;
- }
-
- if ($kt_document_detail->status_code != 0)
- {
- return new PEAR_Error($kt_document_detail->message);
- }
-
- $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail);
- return $document;
- }
-}
-
-class KTWSAPI_Document extends KTWSAPI_FolderItem
-{
- var $document_id;
- var $title;
- var $document_type;
- var $version;
- var $filename;
- var $created_date;
- var $created_by;
- var $updated_date;
- var $updated_by;
- var $workflow;
- var $workflow_state;
- var $checkout_by;
- var $full_path;
-
- /**
- * Constructor
- *
- * @param KTWSAPI $ktapi
- * @param kt_document_detail $kt_document_detail
- * @return KTWSAPI_Document
- */
- function KTWSAPI_Document(&$ktapi, $kt_document_detail)
- {
- $this->ktapi=&$ktapi;
- $this->document_id = $kt_document_detail->document_id;
- $this->title = $kt_document_detail->title;
- $this->document_type = $kt_document_detail->document_type;
- $this->version = $kt_document_detail->version;
- $this->filename = $kt_document_detail->filename;
- $this->created_date = $kt_document_detail->created_date;
- $this->created_by = $kt_document_detail->created_by;
- $this->updated_date = $kt_document_detail->updated_date;
- $this->updated_by = $kt_document_detail->updated_by;
- $this->parent_id = $kt_document_detail->folder_id;
- $this->workflow = $kt_document_detail->workflow;
- $this->workflow_state = $kt_document_detail->workflow_state;
- $this->checkout_by = $kt_document_detail->checkout_by;
- $this->full_path = $kt_document_detail->full_path;
- }
-
- /**
- * Returns a reference to a document.
- *
- * @param KTWSAPI $ktapi
- * @param int $documentid
- * @param boolean $loadinfo
- * @return KTWSAPI_Document
- */
- function &get(&$ktapi, $documentid, $loadinfo=true)
- {
- assert(!is_null($ktapi));
- assert(is_a($ktapi, 'KTWSAPI'));
- assert(is_numeric($documentid));
-
- if ($loadinfo)
- {
- $kt_document_detail = $ktapi->soapclient->get_document_detail($ktapi->session, $documentid);
- if (SOAP_Client::isError($kt_document_detail))
- {
- return $kt_document_detail;
- }
-
- if ($kt_document_detail->status_code != 0)
- {
- return new PEAR_Error($kt_document_detail->message);
- }
- }
- else
- {
- $kt_document_detail = array(
- 'document_id'=>$documentid,
- );
- }
-
- $document=& new KTWSAPI_Document($ktapi, $kt_document_detail);
- return $document;
- }
-
- /**
- * Checks in a document.
- *
- * @param string $filename
- * @param string $reason
- * @param boolean $major_update
- * @return true
- */
- function checkin($filename, $reason, $major_update )
- {
- $basename=basename($filename);
-
- $tempfilename = $this->_upload_file($filename,'C', $this->document_id);
- if (PEAR::isError($tempfilename))
- {
- return new PEAR_Error($tempfilename->message);
- }
-
- $kt_response = $this->ktapi->soapclient->checkin_document($this->ktapi->session, $this->document_id, $basename, $reason, $tempfilename, $major_update );
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Checks out a document.
- *
- * @param string $reason
- * @param string $localpath
- * @return true
- */
- function checkout($reason, $localpath=null)
- {
- if (is_null($localpath))
- {
- $localpath = $this->ktapi->get_download_path();
- }
-
- if (!is_dir($localpath))
- {
- return new PEAR_Error('local path does not exist');
- }
- if (!is_writable($localpath))
- {
- return new PEAR_Error('local path is not writable');
- }
-
- $kt_response = $this->ktapi->soapclient->checkout_document($this->ktapi->session, $this->document_id, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- $url = $kt_response->message;
-
- $response = $this->_download_file($url, $localpath, $this->filename);
- if (PEAR::isError($response))
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Undo a document checkout
- *
- * @param string $reason
- * @return true
- */
- function undo_checkout($reason)
- {
- $kt_response = $this->ktapi->soapclient->undo_document_checkout($this->ktapi->session, $this->document_id, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Download a version of the document
- *
- * @param string $version
- * @param string $localpath
- * @return true
- */
- function download($version=null, $localpath=null)
- {
- if (is_null($localpath))
- {
- $localpath = $this->ktapi->get_download_path();
- }
-
- if (!is_dir($localpath))
- {
- return new PEAR_Error('local path does not exist');
- }
- if (!is_writable($localpath))
- {
- return new PEAR_Error('local path is not writable');
- }
-
- $kt_response = $this->ktapi->soapclient->download_document($this->ktapi->session, $this->document_id);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- $url = $kt_response->message;
-
- $response = $this->_download_file($url, $localpath, $this->filename);
- if (PEAR::isError($response))
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Deletes the current document.
- *
- * @param string $reason
- * @return true
- */
- function delete($reason)
- {
- $kt_response = $this->ktapi->soapclient->delete_document($this->ktapi->session, $this->document_id, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Changes the owner of the document.
- *
- * @param string $username
- * @param string $reason
- * @return true
- */
- function change_owner($username, $reason)
- {
- $kt_response = $this->ktapi->soapclient->change_document_owner($this->ktapi->session, $this->document_id, $username, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Copies the document to the specified folder.
- *
- * @param KTWSAPI_Folder $folder
- * @param string $reason
- * @param string $newtitle
- * @param string $newfilename
- */
- function copy(&$folder,$reason,$newtitle='',$newfilename='')
- {
- assert(is_a($folder,'KTWSAPI_Folder'));
- assert(!is_null($folder));
-
- $folder_id = $folder->folderid;
- $kt_response = $this->ktapi->soapclient->copy_document($this->ktapi->session, $this->document_id, $folder_id, $reason, $newtitle, $newfilename);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Moves the current folder to the specified folder.
- *
- * @param KTWSAPI_Folder $folder
- * @param string $reason
- * @param string $newtitle
- * @param string $newfilename
- * @return true
- */
- function move(&$folder,$reason,$newtitle='',$newfilename='')
- {
- assert(is_a($folder,'KTWSAPI_Folder'));
- assert(!is_null($folder));
-
- $folder_id = $folder->folderid;
- $kt_response = $this->ktapi->soapclient->move_document($this->ktapi->session, $this->document_id, $folder_id, $reason, $newtitle, $newfilename);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Changes the document type.
- *
- * @param string $documenttype
- * @return true
- */
- function change_document_type($documenttype)
- {
- $kt_response = $this->ktapi->soapclient->change_document_type($this->ktapi->session, $this->document_id, $documenttype);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Renames the title of the current document.
- *
- * @param string $newtitle
- * @return true
- */
- function rename_title( $newtitle)
- {
- $kt_response = $this->ktapi->soapclient->rename_document_title($this->ktapi->session, $this->document_id, $newtitle);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Renames the filename of the current document.
- *
- * @param string $newfilename
- * @return true
- */
- function rename_filename( $newfilename)
- {
- $kt_response = $this->ktapi->soapclient->rename_document_filename($this->ktapi->session, $this->document_id, $newfilename);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Starts a workflow on the current document.
- *
- * @param string $workflow
- * @return true
- */
- function start_workflow($workflow)
- {
- $kt_response = $this->ktapi->soapclient->start_document_workflow($this->ktapi->session, $this->document_id, $workflow);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Removes the workflow process from the current document.
- *
- * @return true
- */
- function delete_workflow()
- {
- $kt_response = $this->ktapi->soapclient->delete_document_workflow($this->ktapi->session, $this->document_id);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Performs a transition on the current document.
- *
- * @param string $transition
- * @param string $reason
- * @return true
- */
- function perform_workflow_transition($transition,$reason)
- {
- $kt_response = $this->ktapi->soapclient->perform_workflow_transition($this->ktapi->session, $this->document_id, $transition, $reason);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Returns metadata on the document.
- *
- * @return kt_metadata_response
- */
- function get_metadata()
- {
- $kt_metadata_response = $this->ktapi->soapclient->get_document_metadata($this->ktapi->session, $this->document_id );
- if (SOAP_Client::isError($kt_metadata_response))
- {
- return $kt_metadata_response;
- }
-
- if ($kt_metadata_response->status_code != 0)
- {
- return new PEAR_Error($kt_metadata_response->message);
- }
-
- return $kt_metadata_response;
- }
-
- /**
- * Updates the metadata on the current document.
- *
- * @param kt_metadata $metadata
- * @return true
- */
- function update_metadata($metadata)
- {
- $kt_response = $this->ktapi->soapclient->update_document_metadata($this->ktapi->session, $this->document_id, $metadata);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return true;
- }
-
- /**
- * Returns the transaction history on the current document.
- *
- * @return kt_document_transaction_history
- */
- function get_transaction_history()
- {
- $kt_document_transaction_history_response = $this->ktapi->soapclient->get_document_transaction_history($this->ktapi->session, $this->document_id);
- if (SOAP_Client::isError($kt_document_transaction_history_response))
- {
- return $kt_document_transaction_history_response;
- }
-
- if ($kt_document_transaction_history_response->status_code != 0)
- {
- return new PEAR_Error($kt_document_transaction_history_response->message);
- }
-
- return $kt_document_transaction_history_response->history;
- }
-
- /**
- * Returns the version history on the current document.
- *
- * @return $kt_document_version_history
- */
- function get_version_history()
- {
- $kt_document_version_history_response = $this->ktapi->soapclient->get_document_version_history($this->ktapi->session, $this->document_id);
- if (SOAP_Client::isError($kt_document_version_history_response))
- {
- return $kt_document_version_history_response;
- }
-
- if ($kt_document_version_history_response->status_code != 0)
- {
- return new PEAR_Error($kt_document_version_history_response->message);
- }
-
- return $kt_document_version_history_response->history;
- }
-}
-
-class KTWSAPI
-{
- var $wsdl;
- /**
- * Enter description here...
- *
- * @var SOAP_Client
- */
- var $soapclient;
- var $timeout;
- var $session;
- var $download_path;
-
- /**
- * Constructor
- *
- * @param string $wsdl
- * @param int $timeout
- * @return KTWSAPI
- */
- function KTWSAPI($wsdl = KTWebService_WSDL, $timeout=30)
- {
- $this->wsdl = new SOAP_WSDL($wsdl);
- $this->timeout = $timeout;
- $this->soapclient = $this->wsdl->getProxy();
- $this->soapclient->setOpt('timeout', $this->timeout);
- $this->download_path = 'c:/temp';
- }
-
- /**
- * This returns the default location where documents are downloaded in download() and checkout().
- *
- * @return string
- */
- function get_download_path()
- {
- return $this->download_path;
- }
-
- /**
- * Allows the default location for downloaded documents to be changed.
- *
- * @param string $download_path
- * @return true
- */
- function set_download_path($download_path)
- {
- if (!is_dir($download_path))
- {
- return new PEAR_Error('local path is not writable');
- }
-
- if (!is_writable($download_path))
- {
- return new PEAR_Error('local path is not writable');
- }
- $this->download_path = $download_path;
- return true;
- }
-
- /**
- * Starts an anonymous session.
- *
- * @param string $ip
- * @return string
- */
- function start_anonymous_session($ip=null)
- {
- return $this->start_session('anonymous','',$ip);
- }
-
- /**
- * Starts a user session.
- *
- * @param string $username
- * @param string $password
- * @param string $ip
- * @return string
- */
- function start_session($username, $password, $ip=null)
- {
- if (!is_null($this->session))
- {
- return new PEAR_Error(KTWSAPI_ERR_SESSION_IN_USE);
- }
- $kt_response = $this->soapclient->login($username, $password, $ip);
- if (SOAP_Client::isError($kt_response))
- {
- return $kt_response;
- }
-
- if ($kt_response->status_code == 0)
- {
- $this->session = $kt_response->message;
- }
- else
- {
- return new PEAR_Error($kt_response->message);
- }
-
- return $this->session;
- }
-
- /**
- * Sets an active session.
- *
- * @param string $session
- * @param string $ip
- * @return string
- */
- function active_session($session, $ip=null)
- {
- if (!is_null($this->session))
- {
- return new PEAR_Error(KTWSAPI_ERR_SESSION_IN_USE);
- }
- $this->session = $session;
-
- return $session;
- }
-
- /**
- * Closes an active session.
- *
- * @return true
- */
- function logout()
- {
- if (is_null($this->session))
- {
- return new PEAR_Error(KTWSAPI_ERR_SESSION_NOT_STARTED);
- }
-
- $kt_response = $this->soapclient->logout($this->session);
-
- if ($kt_response->status_code != 0)
- {
- return new PEAR_Error($kt_response->message);
- }
- $this->session = null;
-
- return true;
- }
-
- /**
- * Returns a reference to the root folder.
- *
- * @return KTWSAPI_Folder
- */
- function &get_root_folder()
- {
- return $this->get_folder_by_id(1);
- }
-
- /**
- * Returns a reference to a folder based on id.
- *
- * @return KTWSAPI_Folder
- */
- function &get_folder_by_id($folderid)
- {
- if (is_null($this->session))
- {
- return new PEAR_Error('A session is not active');
- }
-
- return KTWSAPI_Folder::get($this, $folderid);
- }
-
- /**
- * Returns a reference to a document based on id.
- *
- * @param int $documentid
- * @return KTWSAPI_Document
- */
- function &get_document_by_id($documentid)
- {
- if (is_null($this->session))
- {
- return new PEAR_Error('A session is not active');
- }
-
- return KTWSAPI_Document::get($this, $documentid);
- }
-}
-
-?>
diff --git a/ktwsapi/php/ktwsapi_cfg.inc.php b/ktwsapi/php/ktwsapi_cfg.inc.php
deleted file mode 100644
index 3fe2d28..0000000
--- a/ktwsapi/php/ktwsapi_cfg.inc.php
+++ /dev/null
@@ -1,48 +0,0 @@
-
diff --git a/ktwsapi/python/TODO.txt b/ktwsapi/python/TODO.txt
deleted file mode 100644
index e69de29..0000000
--- a/ktwsapi/python/TODO.txt
+++ /dev/null
diff --git a/ktwsapi/ruby/TODO.txt b/ktwsapi/ruby/TODO.txt
deleted file mode 100644
index e69de29..0000000
--- a/ktwsapi/ruby/TODO.txt
+++ /dev/null
diff --git a/login.php b/login.php
index b9ef29a..e0da592 100644
--- a/login.php
+++ b/login.php
@@ -8,32 +8,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*/
@@ -95,24 +95,24 @@ class LoginPageDispatcher extends KTDispatcher {
#var_dump($oUser);
#var_dump(PEAR::raiseError());
}
- $iOldUserID = checkLastSessionUserID();
-
- //if the current person logging in isn't the same person who logged out or timed out
- //then set the redirect to the dashboard and not the last page that was viewed.
- if ($oUser->getId() != $iOldUserID['user_id'])
+
+ // If the last user from the same IP address timed out within the last hour then redirect to the dashboard
+ // Otherwise allow any other redirect to continue.
+ // The user might still be taken to the last page of the previous users session but
+ // if we always redirect to dashboard then we break other features such as linking in from emails or documents.
+ if (checkLastSessionUserID($oUser->getId()))
{
$_REQUEST['redirect'] = generateControllerLink('dashboard');
-
}
-
+
$session = new Session();
$sessionID = $session->create($oUser);
if (PEAR::isError($sessionID)) {
return $sessionID;
}
-
+
$redirect = KTUtil::arrayGet($_REQUEST, 'redirect');
-
+
// DEPRECATED initialise page-level authorisation array
$_SESSION["pageAccess"] = NULL;
@@ -156,9 +156,9 @@ class LoginPageDispatcher extends KTDispatcher {
$errorMessage = KTUtil::arrayGet($_REQUEST, 'errorMessage');
session_start();
-
+
$errorMessageConfirm = $_SESSION['errormessage']['login'];
-
+
$redirect = KTUtil::arrayGet($_REQUEST, 'redirect');
$oReg =& KTi18nregistry::getSingleton();
@@ -337,16 +337,46 @@ class LoginPageDispatcher extends KTDispatcher {
}
}
-//FIXME Direct Database Access
-//checkLastSessionUserID finds the last user to logout or timeout
-function checkLastSessionUserID()
+/**
+ * Check if the last user logging in from the same IP as the current user timed out in the last hour.
+ *
+ * @param unknown_type $userId
+ * @return unknown
+ */
+function checkLastSessionUserID($userId)
{
- $sQuery = 'SELECT user_id FROM user_history ORDER BY id DESC LIMIT 1';
- $res = DBUtil::getOneResult($sQuery);
- return $res;
+ // Get the current users IP Address
+ $sIp = '%'.$_SERVER['REMOTE_ADDR'];
+
+ // Get the time for a day ago and an hour ago
+ $dif = time() - (24*60*60);
+ $sDayAgo = date('Y-m-d H:i:s', $dif);
+ $dif2 = time() - (60*60);
+ $sHourAgo = date('Y-m-d H:i:s', $dif2);
+
+ // Get the session id for the last user to log in from the current IP address within the last day
+ // Use the session id to find if that user logged out or timed out within the last hour.
+ $sQuery = 'SELECT user_id, action_namespace FROM user_history
+ WHERE datetime > ? AND
+ session_id = (SELECT session_id FROM user_history WHERE comments LIKE ? AND datetime > ? ORDER BY id DESC LIMIT 1)
+ ORDER BY id DESC LIMIT 1';
+
+ $aParams = array($sHourAgo, $sIp, $sDayAgo);
+ $res = DBUtil::getOneResult(array($sQuery, $aParams));
+
+ if(PEAR::isError($res) || empty($res)){
+ return false;
+ }
+
+ // Check whether the user timed out and whether it was the current user or a different one
+ if($res['action_namespace'] == 'ktcore.user_history.timeout' && $res['user_id'] != $userId){
+ return true;
+ }
+
+ return false;
}
$dispatcher =& new LoginPageDispatcher();
$dispatcher->dispatch();
-?>
+?>
\ No newline at end of file
diff --git a/plugins/rssplugin/KTrss.inc.php b/plugins/rssplugin/KTrss.inc.php
index bf94e9b..2d15cf2 100644
--- a/plugins/rssplugin/KTrss.inc.php
+++ b/plugins/rssplugin/KTrss.inc.php
@@ -336,111 +336,145 @@ class KTrss{
$sSuffix = '';
}
$hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$sSuffix;
- $feed = "\n";
- $feed .= "\n".
- "\n" .
- "".APP_NAME." RSS \n" .
- "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved \n" .
- " ".$hostPath."\n" .
- "KT-RSS \n" .
- "\n".
- "".APP_NAME." RSS \n".
- "140 \n".
- "28 ".
- " ".$hostPath."knowledgeTree/\n".
- "".$hostPath."resources/graphics/ktlogo_rss.png \n".
- " \n";
- foreach($aItems as $aItems){
- if($aItems[0][itemType] == 'folder'){
- $sTypeSelect = 'folder.transactions&fFolderId';
- }elseif($aItems[0][itemType] == 'document'){
- $sTypeSelect = 'document.transactionhistory&fDocumentId';
+
+ $head = "\n
+ \n
+ \n
+ ".APP_NAME." RSS \n
+ (c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved \n
+ ".$hostPath."\n
+ KT-RSS \n
+ \n
+ ".APP_NAME." RSS \n
+ 140 \n
+ 28
+ ".$hostPath."knowledgeTree/\n
+ ".$hostPath."resources/graphics/ktlogo_rss.png \n
+ \n";
+
+
+ $feed = '';
+ foreach($aItems as $aItem){
+
+ $aItemHead = $aItem[0][0];
+ $aItemList = $aItem[1];
+
+ if($aItem[0][itemType] == 'folder'){
+ $sTypeSelect = 'folder.transactions&fFolderId';
+ }elseif($aItem[0][itemType] == 'document'){
+ $sTypeSelect = 'document.transactionhistory&fDocumentId';
}
- $feed .= "- \n" .
- "
".htmlentities(KTrss::rss_sanitize($aItems[0][0][name],false), ENT_QUOTES, 'UTF-8')." \n" .
- " ".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."\n" .
- "\n" .
- "<table border='0' width='90%'>\n".
- "<tr>\n".
- "<td width='5%' height='16px'>" .
- "<a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0][id]."' ><img src='".$aItems[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a>" .
- "</td>\n".
- "<td align='left'> ".$aItems[0][mimeTypeFName]."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td colspan='2'>\n".
- ucfirst($aItems[0]['itemType'])." Information (ID: ".$aItems[0][0][id].")</>\n".
- "<hr>\n".
- "<table width='95%'>\n".
- "<tr>\n".
- "<td>Filename: ".KTrss::rss_sanitize($aItems[0][0][filename])."</td>\n".
- "<td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>Author: ".$aItems[0][0][author]."</td>\n".
- "<td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>Owner: ";if($aItems[0][0][owner]){$feed .= $aItems[0][0][owner];}else{$feed .= "None";}
- $feed .= "</td>\n".
- "<td></td>\n".
- "</tr>\n".
- "<tr>\n";if($aItems[0][0][type]){
- $feed .= "<td>Document type: ".$aItems[0][0][type]."</td>\n".
- "<td></td>\n";}
- $feed .= "</tr>\n".
- "<tr>\n".
- "<td>Workflow status: ";if($aItems[0][0][workflow_status]){$feed .= $aItems[0][0][workflow_status];}else{$feed .= "No Workflow";}
- $feed .= "</td>\n".
- "<td></td>\n".
- "</tr>\n".
- "</table><br>\n".
- "Transaction Summary (Last 4)\n".
- "<hr>\n".
- "<table width='100%'>\n";
- foreach($aItems[1] as $item){
- $feed .= "<tr>\n".
- "<td>".$item[type]." name:</td>\n".
- "<td>".KTrss::rss_sanitize($item[name] )."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>Path:</td>\n".
- "<td>".KTrss::rss_sanitize($item[fullpath] )."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>Transaction:</td>\n".
- "<td>".$item[transaction_name]."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>Comment:</td>\n".
- "<td>".KTrss::rss_sanitize($item[comment] )."</td>\n".
- "</tr>\n".
- "<tr>\n";if($item[version]){
- $feed .= "<td>Version:</td>\n".
- "<td>".$item[version]."</td>\n";}
- $feed .= "</tr>\n".
- "<tr>\n".
- "<td>Date:</td>\n".
- "<td>".$item[datetime]."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td>User:</td>\n".
- "<td>".$item[user_name]."</td>\n".
- "</tr>\n".
- "<tr>\n".
- "<td colspan='2'><hr width='100' align='left'></td>\n".
- "</tr>\n";}
- $feed .= "</table>\n".
- "</td>\n".
- "</tr>\n".
- "</table>".
- " \n".
- " \n";
+
+
+ if($aItem[0][0][owner]){
+ $owner = $aItem[0][0][owner];
+ }else{
+ $owner = _kt('None');
+ }
+
+ $type = '';
+ if($aItem[0][0][type]){
+ $type = 'Document type: '.$aItem[0][0][type]." \n \n";
+ }
+
+ if($aItem[0][0][workflow_status]){
+ $workflow = $aItem[0][0][workflow_status];
+ }else{
+ $workflow = _kt('No Workflow');
+ }
+
+ $xmlItemHead = "- \n
+
".htmlentities($aItem[0][0][name], ENT_QUOTES, 'UTF-8')." \n
+ ".$hostPath."action.php?kt_path_info=ktcore.actions.".htmlentities($sTypeSelect, ENT_QUOTES, 'UTF-8')."=".$aItem[0][0]['id']."\n
+ \n";
+
+ $htmlItem = "\n
+ \n
+
+
+
+ \n
+ ".$aItem[0][mimeTypeFName]." \n
+ \n
+ \n
+ \n
+ ".ucfirst($aItem[0]['itemType'])." Information (ID: ".$aItem[0][0][id].")>\n
+ \n
+
+ \n
+ \n
+ "._kt('Filename').": ".$aItem[0][0][filename]." \n
+ \n
+ \n
+ "._kt('Author').": ".$aItem[0][0][author]." \n
+ \n
+ \n
+ "._kt('Owner').": ".$owner." \n
+ \n
+ \n
+ ".$type."\n
+ \n
+ "._kt('Workflow status').": ".$workflow." \n
+ \n
+ \n
+
\n
+
+ "._kt('Transaction Summary (Last 4)')."\n
+ \n
+
+ \n";
+
+ foreach($aItem[1] as $item){
+ $htmlItem .= "\n
+ ".$item[type]." name: \n
+ ".$item[name]." \n
+ \n
+ \n
+ Path: \n
+ ".$item[fullpath]." \n
+ \n
+ \n
+ Transaction: \n
+ ".$item[transaction_name]." \n
+ \n
+ \n
+ Comment: \n
+ ".$item[comment]." \n
+ \n
+ \n";
+
+ if($item[version]){
+ $htmlItem .= "Version: \n
+ ".$item[version]." \n";
+ }
+ $htmlItem .= " \n
+ \n
+ Date: \n
+ ".$item[datetime]." \n
+ \n
+ \n
+ User: \n
+ ".$item[user_name]." \n
+ \n
+ \n
+ \n
+ \n";
+ }
+ $htmlItem .= "
\n
+ \n
+ \n
+
";
+
+ $xmlItemFooter = " \n \n";
+
+ // Use htmlentities to allow html tags in the xml.
+ $htmlItem = htmlentities($htmlItem, ENT_QUOTES, 'UTF-8');
+
+ $feed .= $xmlItemHead.$htmlItem.$xmlItemFooter;
}
- $feed .= " \n" .
- " \n";
+ $footer = " \n \n";
- return $feed;
+ return $head.$feed.$footer;
}
// Takes in an array as a parameter and returns rss2.0 compatible xml
@@ -449,26 +483,28 @@ class KTrss{
$aPath = explode('/', trim($_SERVER['PHP_SELF']));
global $default;
$hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/";
- $feed = "\n";
- $feed .= "\n".
- "\n" .
- "".APP_NAME." RSS \n" .
- "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved \n" .
- " ".$hostPath."\n" .
- "KT-RSS \n" .
- "\n".
- "".APP_NAME." RSS \n".
- "140 \n".
- "28 ".
- " ".$hostPath."knowledgeTree/\n".
- "".$hostPath."resources/graphics/ktlogo_rss.png \n".
- " \n";
- $feed .= "- \n".
- "
Feed load error \n" .
- "".$sError." \n".
- " \n";
- $feed .= " \n" .
- " \n";
+ $feed = "\n
+ \n
+
+ \n
+ ".APP_NAME." RSS \n
+ (c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved \n
+ {$hostPath}\n
+ KT-RSS \n
+ \n
+ ".APP_NAME." RSS \n
+ 140 \n
+ 28
+ {$hostPath}knowledgeTree/\n
+ {$hostPath}resources/graphics/ktlogo_rss.png \n
+ \n
+ - \n
+
Feed load error \n
+ ".$sError." \n
+ \n
+ \n
+
+ \n";
return $feed;
}
diff --git a/resources/css/kt-framing.css b/resources/css/kt-framing.css
index 9763b18..1377dd0 100644
--- a/resources/css/kt-framing.css
+++ b/resources/css/kt-framing.css
@@ -1817,6 +1817,7 @@ hr {
#content ul {
list-style-image: url(../graphics/bullet.png);
+ padding-left: 15px;
}
diff --git a/rss.php b/rss.php
index 8ba71d7..a28f131 100644
--- a/rss.php
+++ b/rss.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*/
@@ -66,75 +66,79 @@ if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) {
}
if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
- header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"');
- header('HTTP/1.0 401 Unauthorized');
- echo 'This RSS feed requires authentication. Please enter your username and password.';
- exit;
+ header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'This RSS feed requires authentication. Please enter your username and password.';
+ exit;
} else {
- $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',));
- $id = $user[$_SERVER['PHP_AUTH_USER']]['id'];
+ $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',));
+ $id = $user[$_SERVER['PHP_AUTH_USER']]['id'];
+ header('Content-Type: application/rss+xml; charset=utf-8;');
+ header('Content-Disposition: inline; filename="rss.xml"');
+ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed
- // get document id from http request object
- $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId');
+ if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed
+ // get document id from http request object
+ $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId');
- if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check
- // get document info
- $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id);
+ if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check
+ // get document info
+ $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id);
- if($aDocumentInfo){
- // create rss xml for document
- $documentFeed = KTrss::arrayToXML($aDocumentInfo);
- }else{
- // create rss xml for the error
- $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
- }
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' .
- ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.'));
- }
- if(isset($error)){ // if an error exist, output...else out the result
- echo $error;
- }else{
- echo $documentFeed;
- }
- }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed
- // get folder id from http request object
- $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId');
+ if($aDocumentInfo){
+ // create rss xml for document
+ $documentFeed = KTrss::arrayToXML($aDocumentInfo);
+ }else{
+ // create rss xml for the error
+ $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
+ }
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' .
+ ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.'));
+ }
+ if(isset($error)){ // if an error exist, output...else out the result
+ echo $error;
+ }else{
+ echo $documentFeed;
+ }
+ }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed
+ // get folder id from http request object
+ $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId');
- if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check
- // get folder info
- $aFolderInfo[] = KTrss::getOneFolder($iFolderId);
+ if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check
+ // get folder info
+ $aFolderInfo[] = KTrss::getOneFolder($iFolderId);
- if($aFolderInfo){
- // create rss xml for folder
- $folderFeed = KTrss::arrayToXML($aFolderInfo);
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
- }
- }else{
- // create rss xml for error
- $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' .
- ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.'));
- }
- if(isset($error)){ // if an error exist, output...else out the result
- echo $error;
- }else{
- echo $folderFeed;
- }
- }else{ // else do normal rss parsing
- // get full list of subscribed documents and folders
- $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id));
- $internalFeed = KTrss::arrayToXML($aFullList);
- echo $internalFeed;
- }
+ if($aFolderInfo){
+ // create rss xml for folder
+ $folderFeed = KTrss::arrayToXML($aFolderInfo);
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('This document has returned a empty response'));
+ }
+ }else{
+ // create rss xml for error
+ $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' .
+ ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.'));
+ }
+ if(isset($error)){ // if an error exist, output...else out the result
+ echo $error;
+ }else{
+ echo $folderFeed;
+ }
+ }else{ // else do normal rss parsing
+ // get full list of subscribed documents and folders
+ $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id));
+ $internalFeed = KTrss::arrayToXML($aFullList);
+ echo $internalFeed;
+ }
}
// Validate user credentials
function validateUser($username, $password){
- return DBAuthenticator::checkPassword($username, $password);
+ return DBAuthenticator::checkPassword($username, $password);
}
-?>
+?>
\ No newline at end of file
diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql
index 345aee1..4b253bd 100644
--- a/sql/mysql/install/data.sql
+++ b/sql/mysql/install/data.sql
@@ -765,7 +765,9 @@ INSERT INTO `plugins` VALUES
(18,'ktstandard.disclaimers.plugin','plugins/ktstandard/KTDisclaimers.php',0,0,NULL,0,'Disclaimers Plugin',0),
(19,'nbm.browseable.plugin','plugins/browseabledashlet/BrowseableDashletPlugin.php',0,0,NULL,0,'Orphaned Folders Plugin',0),
(20,'ktstandard.ktwebdavdashlet.plugin','plugins/ktstandard/KTWebDAVDashletPlugin.php',0,0,NULL,0,'WebDAV Dashlet Plugin',0),
- (21,'ktcore.housekeeper.plugin','plugins/housekeeper/HouseKeeperPlugin.php',0,0,NULL,0,'Housekeeper',0);
+ (21,'ktcore.housekeeper.plugin','plugins/housekeeper/HouseKeeperPlugin.php',0,0,NULL,0,'Housekeeper',0),
+ (22,'ktcore.scheduler.plugin','plugins/ktcore/scheduler/KTSchedulerPlugin.php',0,0,NULL,0,'Task Scheduler Plugin',0),
+ (23,'ktcore.schedulerdashlet.plugin','plugins/ktcore/scheduler/schedulerDashletPlugin.php',0,0,NULL,0,'Scheduler Dashlet Plugin',0);
/*!40000 ALTER TABLE `plugins` ENABLE KEYS */;
UNLOCK TABLES;
@@ -1680,7 +1682,7 @@ UNLOCK TABLES;
LOCK TABLES `zseq_plugins` WRITE;
/*!40000 ALTER TABLE `zseq_plugins` DISABLE KEYS */;
-INSERT INTO `zseq_plugins` VALUES (21);
+INSERT INTO `zseq_plugins` VALUES (23);
/*!40000 ALTER TABLE `zseq_plugins` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/templates/ktcore/principals/about.smarty b/templates/ktcore/principals/about.smarty
index 44fb6ec..e11e0b0 100644
--- a/templates/ktcore/principals/about.smarty
+++ b/templates/ktcore/principals/about.smarty
@@ -11,7 +11,7 @@ KnowledgeTree™ is a http://www.knowledgetree.com
+http://www.knowledgetree.com
KnowledgeTree Sales