Commit 579dcb63dcfb96bf29c183c6c0ee891357d18eae
1 parent
0d54dc56
Merged in from DEV trunk...
KTS-2143 "Manage Lookups for Field: Explanations incorrect" Fixed. Commited By: Kevin Fourie Reviewed By: Conrad Vermeulen Updated About page. Committed By: Kevin Fourie Reviewed By: Conrad Vermeulen KTS-3033 "The bullets on the welcome dashlet render incorrectly" Fixed. Added some left padding Committed By: Megan Watson Reviewed By: Jalaloedien Abrahams KTC-177 "RSS feed appears wrong when launched from the 'Actions on this folder' when the folder has the internationalisation string as its name or the name of any of its subfolders." Fixed. Added headers before displaying the feed. Cleaned up the htmlentities in the feed. Committed By: Megan Watson Reviewed By: Jonathan Byrne KTS-3020 "When sent a link to a document in KnowledgeTree, asked to log in, but not taken to the document - taken to the dashboard." Fixed. Modified the check on the last user to use the ip address and check if the last user timed out or not. Committed by: Megan Watson Reviewed by: Jonathan Byrne KTS-3025 "Move KTWSAPI foders to KnowledgeTree forge" Moved. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie KTS-3038 "Scheduler plugins are not in the default data.sql install file" Fixed. Updeated data.sql file. Committed By: Kevin Fourie Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8063 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
30 changed files
with
294 additions
and
5346 deletions
ktwsapi/README.txt deleted
ktwsapi/cpp/TODO.txt deleted
ktwsapi/delphi/doc/KTWSAPI.chm deleted
No preview for this file type
ktwsapi/delphi/examples/KTWSAPIExamples.bdsproj deleted
| 1 | -<?xml version="1.0" encoding="utf-8"?> | |
| 2 | -<BorlandProject> | |
| 3 | - <PersonalityInfo> | |
| 4 | - <Option> | |
| 5 | - <Option Name="Personality">Delphi.Personality</Option> | |
| 6 | - <Option Name="ProjectType">VCLApplication</Option> | |
| 7 | - <Option Name="Version">1.0</Option> | |
| 8 | - <Option Name="GUID">{A7B8ECC5-0F7B-4E7C-8C44-8356FDCDB36A}</Option> | |
| 9 | - </Option> | |
| 10 | - </PersonalityInfo> | |
| 11 | - <Delphi.Personality> | |
| 12 | - <Source> | |
| 13 | - <Source Name="MainSource">KTWSAPIExamples.dpr</Source> | |
| 14 | - </Source> | |
| 15 | - <FileVersion> | |
| 16 | - <FileVersion Name="Version">7.0</FileVersion> | |
| 17 | - </FileVersion> | |
| 18 | - <Compiler> | |
| 19 | - <Compiler Name="A">8</Compiler> | |
| 20 | - <Compiler Name="B">0</Compiler> | |
| 21 | - <Compiler Name="C">1</Compiler> | |
| 22 | - <Compiler Name="D">1</Compiler> | |
| 23 | - <Compiler Name="E">0</Compiler> | |
| 24 | - <Compiler Name="F">0</Compiler> | |
| 25 | - <Compiler Name="G">1</Compiler> | |
| 26 | - <Compiler Name="H">1</Compiler> | |
| 27 | - <Compiler Name="I">1</Compiler> | |
| 28 | - <Compiler Name="J">0</Compiler> | |
| 29 | - <Compiler Name="K">0</Compiler> | |
| 30 | - <Compiler Name="L">1</Compiler> | |
| 31 | - <Compiler Name="M">0</Compiler> | |
| 32 | - <Compiler Name="N">1</Compiler> | |
| 33 | - <Compiler Name="O">1</Compiler> | |
| 34 | - <Compiler Name="P">1</Compiler> | |
| 35 | - <Compiler Name="Q">0</Compiler> | |
| 36 | - <Compiler Name="R">0</Compiler> | |
| 37 | - <Compiler Name="S">0</Compiler> | |
| 38 | - <Compiler Name="T">0</Compiler> | |
| 39 | - <Compiler Name="U">0</Compiler> | |
| 40 | - <Compiler Name="V">1</Compiler> | |
| 41 | - <Compiler Name="W">0</Compiler> | |
| 42 | - <Compiler Name="X">1</Compiler> | |
| 43 | - <Compiler Name="Y">1</Compiler> | |
| 44 | - <Compiler Name="Z">1</Compiler> | |
| 45 | - <Compiler Name="ShowHints">True</Compiler> | |
| 46 | - <Compiler Name="ShowWarnings">True</Compiler> | |
| 47 | - <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler> | |
| 48 | - <Compiler Name="NamespacePrefix"></Compiler> | |
| 49 | - <Compiler Name="GenerateDocumentation">False</Compiler> | |
| 50 | - <Compiler Name="DefaultNamespace"></Compiler> | |
| 51 | - <Compiler Name="SymbolDeprecated">True</Compiler> | |
| 52 | - <Compiler Name="SymbolLibrary">True</Compiler> | |
| 53 | - <Compiler Name="SymbolPlatform">True</Compiler> | |
| 54 | - <Compiler Name="SymbolExperimental">True</Compiler> | |
| 55 | - <Compiler Name="UnitLibrary">True</Compiler> | |
| 56 | - <Compiler Name="UnitPlatform">True</Compiler> | |
| 57 | - <Compiler Name="UnitDeprecated">True</Compiler> | |
| 58 | - <Compiler Name="UnitExperimental">True</Compiler> | |
| 59 | - <Compiler Name="HResultCompat">True</Compiler> | |
| 60 | - <Compiler Name="HidingMember">True</Compiler> | |
| 61 | - <Compiler Name="HiddenVirtual">True</Compiler> | |
| 62 | - <Compiler Name="Garbage">True</Compiler> | |
| 63 | - <Compiler Name="BoundsError">True</Compiler> | |
| 64 | - <Compiler Name="ZeroNilCompat">True</Compiler> | |
| 65 | - <Compiler Name="StringConstTruncated">True</Compiler> | |
| 66 | - <Compiler Name="ForLoopVarVarPar">True</Compiler> | |
| 67 | - <Compiler Name="TypedConstVarPar">True</Compiler> | |
| 68 | - <Compiler Name="AsgToTypedConst">True</Compiler> | |
| 69 | - <Compiler Name="CaseLabelRange">True</Compiler> | |
| 70 | - <Compiler Name="ForVariable">True</Compiler> | |
| 71 | - <Compiler Name="ConstructingAbstract">True</Compiler> | |
| 72 | - <Compiler Name="ComparisonFalse">True</Compiler> | |
| 73 | - <Compiler Name="ComparisonTrue">True</Compiler> | |
| 74 | - <Compiler Name="ComparingSignedUnsigned">True</Compiler> | |
| 75 | - <Compiler Name="CombiningSignedUnsigned">True</Compiler> | |
| 76 | - <Compiler Name="UnsupportedConstruct">True</Compiler> | |
| 77 | - <Compiler Name="FileOpen">True</Compiler> | |
| 78 | - <Compiler Name="FileOpenUnitSrc">True</Compiler> | |
| 79 | - <Compiler Name="BadGlobalSymbol">True</Compiler> | |
| 80 | - <Compiler Name="DuplicateConstructorDestructor">True</Compiler> | |
| 81 | - <Compiler Name="InvalidDirective">True</Compiler> | |
| 82 | - <Compiler Name="PackageNoLink">True</Compiler> | |
| 83 | - <Compiler Name="PackageThreadVar">True</Compiler> | |
| 84 | - <Compiler Name="ImplicitImport">True</Compiler> | |
| 85 | - <Compiler Name="HPPEMITIgnored">True</Compiler> | |
| 86 | - <Compiler Name="NoRetVal">True</Compiler> | |
| 87 | - <Compiler Name="UseBeforeDef">True</Compiler> | |
| 88 | - <Compiler Name="ForLoopVarUndef">True</Compiler> | |
| 89 | - <Compiler Name="UnitNameMismatch">True</Compiler> | |
| 90 | - <Compiler Name="NoCFGFileFound">True</Compiler> | |
| 91 | - <Compiler Name="ImplicitVariants">True</Compiler> | |
| 92 | - <Compiler Name="UnicodeToLocale">True</Compiler> | |
| 93 | - <Compiler Name="LocaleToUnicode">True</Compiler> | |
| 94 | - <Compiler Name="ImagebaseMultiple">True</Compiler> | |
| 95 | - <Compiler Name="SuspiciousTypecast">True</Compiler> | |
| 96 | - <Compiler Name="PrivatePropAccessor">True</Compiler> | |
| 97 | - <Compiler Name="UnsafeType">False</Compiler> | |
| 98 | - <Compiler Name="UnsafeCode">False</Compiler> | |
| 99 | - <Compiler Name="UnsafeCast">False</Compiler> | |
| 100 | - <Compiler Name="OptionTruncated">True</Compiler> | |
| 101 | - <Compiler Name="WideCharReduced">True</Compiler> | |
| 102 | - <Compiler Name="DuplicatesIgnored">True</Compiler> | |
| 103 | - <Compiler Name="UnitInitSeq">True</Compiler> | |
| 104 | - <Compiler Name="LocalPInvoke">True</Compiler> | |
| 105 | - <Compiler Name="MessageDirective">True</Compiler> | |
| 106 | - <Compiler Name="CodePage"></Compiler> | |
| 107 | - </Compiler> | |
| 108 | - <Linker> | |
| 109 | - <Linker Name="MapFile">0</Linker> | |
| 110 | - <Linker Name="OutputObjs">0</Linker> | |
| 111 | - <Linker Name="GenerateHpps">False</Linker> | |
| 112 | - <Linker Name="ConsoleApp">1</Linker> | |
| 113 | - <Linker Name="DebugInfo">False</Linker> | |
| 114 | - <Linker Name="RemoteSymbols">False</Linker> | |
| 115 | - <Linker Name="GenerateDRC">False</Linker> | |
| 116 | - <Linker Name="MinStackSize">16384</Linker> | |
| 117 | - <Linker Name="MaxStackSize">1048576</Linker> | |
| 118 | - <Linker Name="ImageBase">4194304</Linker> | |
| 119 | - <Linker Name="ExeDescription"></Linker> | |
| 120 | - </Linker> | |
| 121 | - <Directories> | |
| 122 | - <Directories Name="OutputDir"></Directories> | |
| 123 | - <Directories Name="UnitOutputDir"></Directories> | |
| 124 | - <Directories Name="PackageDLLOutputDir"></Directories> | |
| 125 | - <Directories Name="PackageDCPOutputDir"></Directories> | |
| 126 | - <Directories Name="SearchPath"></Directories> | |
| 127 | - <Directories Name="Packages"></Directories> | |
| 128 | - <Directories Name="Conditionals"></Directories> | |
| 129 | - <Directories Name="DebugSourceDirs"></Directories> | |
| 130 | - <Directories Name="UsePackages">False</Directories> | |
| 131 | - </Directories> | |
| 132 | - <Parameters> | |
| 133 | - <Parameters Name="RunParams"></Parameters> | |
| 134 | - <Parameters Name="HostApplication"></Parameters> | |
| 135 | - <Parameters Name="Launcher"></Parameters> | |
| 136 | - <Parameters Name="UseLauncher">False</Parameters> | |
| 137 | - <Parameters Name="DebugCWD"></Parameters> | |
| 138 | - <Parameters Name="Debug Symbols Search Path"></Parameters> | |
| 139 | - <Parameters Name="LoadAllSymbols">True</Parameters> | |
| 140 | - <Parameters Name="LoadUnspecifiedSymbols">False</Parameters> | |
| 141 | - </Parameters> | |
| 142 | - <Language> | |
| 143 | - <Language Name="ActiveLang"></Language> | |
| 144 | - <Language Name="ProjectLang">$00000000</Language> | |
| 145 | - <Language Name="RootDir"></Language> | |
| 146 | - </Language> | |
| 147 | - <VersionInfo> | |
| 148 | - <VersionInfo Name="IncludeVerInfo">False</VersionInfo> | |
| 149 | - <VersionInfo Name="AutoIncBuild">False</VersionInfo> | |
| 150 | - <VersionInfo Name="MajorVer">1</VersionInfo> | |
| 151 | - <VersionInfo Name="MinorVer">0</VersionInfo> | |
| 152 | - <VersionInfo Name="Release">0</VersionInfo> | |
| 153 | - <VersionInfo Name="Build">0</VersionInfo> | |
| 154 | - <VersionInfo Name="Debug">False</VersionInfo> | |
| 155 | - <VersionInfo Name="PreRelease">False</VersionInfo> | |
| 156 | - <VersionInfo Name="Special">False</VersionInfo> | |
| 157 | - <VersionInfo Name="Private">False</VersionInfo> | |
| 158 | - <VersionInfo Name="DLL">False</VersionInfo> | |
| 159 | - <VersionInfo Name="Locale">1044</VersionInfo> | |
| 160 | - <VersionInfo Name="CodePage">1252</VersionInfo> | |
| 161 | - </VersionInfo> | |
| 162 | - <VersionInfoKeys> | |
| 163 | - <VersionInfoKeys Name="CompanyName"></VersionInfoKeys> | |
| 164 | - <VersionInfoKeys Name="FileDescription"></VersionInfoKeys> | |
| 165 | - <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> | |
| 166 | - <VersionInfoKeys Name="InternalName"></VersionInfoKeys> | |
| 167 | - <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys> | |
| 168 | - <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys> | |
| 169 | - <VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys> | |
| 170 | - <VersionInfoKeys Name="ProductName"></VersionInfoKeys> | |
| 171 | - <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> | |
| 172 | - <VersionInfoKeys Name="Comments"></VersionInfoKeys> | |
| 173 | - </VersionInfoKeys> <Excluded_Packages> | |
| 174 | - <Excluded_Packages Name="C:\Programfiler\Fellesfiler\RemObjects Software\Everwood\Bin\RemObjects_Everwood_D10.bpl">RemObjects Everwood for Delphi</Excluded_Packages> | |
| 175 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_Core_D10.bpl">RemObjects SDK - Core Library</Excluded_Packages> | |
| 176 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_WebBroker_D10.bpl">RemObjects SDK - WebBroker Library</Excluded_Packages> | |
| 177 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_RODX_D10.bpl">RemObjects SDK - RODXSock Library</Excluded_Packages> | |
| 178 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_BPDX_D10.bpl">RemObjects SDK - BPDX Library</Excluded_Packages> | |
| 179 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_DataSnap_D10.bpl">RemObjects SDK - DataSnap Integration Pack</Excluded_Packages> | |
| 180 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Pascal Script\Dcu\D10\PascalScript_Core_D10.bpl">RemObjects Pascal Script - Core Package</Excluded_Packages> | |
| 181 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Pascal Script\Dcu\D10\PascalScript_RO_D10.bpl">RemObjects Pascal Script - RemObjects SDK 3.0 Integration</Excluded_Packages> | |
| 182 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_Indy_D10.bpl">RemObjects SDK - Indy Library</Excluded_Packages> | |
| 183 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\RemObjects SDK for Delphi\Dcu\D10\RemObjects_IDE_D10.bpl">RemObjects SDK - IDE Integration for Win32</Excluded_Packages> | |
| 184 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_Core_D10.bpl">RemObjects Data Abstract - Core Library</Excluded_Packages> | |
| 185 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_IDE_D10.bpl">RemObjects Data Abstract - IDE Package</Excluded_Packages> | |
| 186 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_ADODriver_D10.bpl">RemObjects Data Abstract - ADOExpress/dbGo Driver</Excluded_Packages> | |
| 187 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_IBXDriver_D10.bpl">RemObjects Data Abstract - InterBase Express Driver</Excluded_Packages> | |
| 188 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_DBXDriver_D10.bpl">RemObjects Data Abstract - dbExpress Driver</Excluded_Packages> | |
| 189 | - <Excluded_Packages Name="C:\Programfiler\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_Scripting_D10.bpl">RemObjects Data Abstract - Scripting Integration Library</Excluded_Packages> | |
| 190 | - </Excluded_Packages> | |
| 191 | - </Delphi.Personality> | |
| 192 | - <StarTeamAssociation></StarTeamAssociation> | |
| 193 | - <StarTeamNonRelativeFiles></StarTeamNonRelativeFiles> | |
| 194 | -</BorlandProject> |
ktwsapi/delphi/examples/KTWSAPIExamples.dpr deleted
| 1 | -{ | |
| 2 | - Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 3 | - | |
| 4 | - All rights reserved. | |
| 5 | - | |
| 6 | - Redistribution and use in source and binary forms, with or without | |
| 7 | - modification, are permitted provided that the following conditions are met: | |
| 8 | - | |
| 9 | - i) Redistributions of source code must retain the above copyright notice, | |
| 10 | - this list of conditions and the following disclaimer. | |
| 11 | - ii) Redistributions in binary form must reproduce the above copyright | |
| 12 | - notice, this list of conditions and the following disclaimer in the | |
| 13 | - documentation and/or other materials provided with the distribution. | |
| 14 | - iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 15 | - names of its contributors may be used to endorse or promote products | |
| 16 | - derived from this software without specific prior written permission. | |
| 17 | - | |
| 18 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 | - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 22 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 23 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 24 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 25 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 26 | - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 27 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 28 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | -} | |
| 30 | - | |
| 31 | -{* | |
| 32 | - This is a Delphi port of the php api for KnowledgeTree WebService. | |
| 33 | - | |
| 34 | - @Author Bjarte Kalstveit Vebj�rnsen <bjarte@macaos.com> | |
| 35 | - @Version 1.0 BKV 24.09.2007 Initial revision | |
| 36 | -*} | |
| 37 | - | |
| 38 | - | |
| 39 | -program KTWSAPIExamples; | |
| 40 | - | |
| 41 | -uses | |
| 42 | - Forms, | |
| 43 | - uFolderContentExample in 'uFolderContentExample.pas' {FolderContentExample}, | |
| 44 | - uwebservice in '..\uwebservice.pas', | |
| 45 | - uktwsapi in '..\uktwsapi.pas', | |
| 46 | - uPHPserialize in '..\uPHPserialize.pas'; | |
| 47 | - | |
| 48 | -{$R *.res} | |
| 49 | - | |
| 50 | -begin | |
| 51 | - Application.Initialize; | |
| 52 | - Application.CreateForm(TFolderContentExample, FolderContentExample); | |
| 53 | - Application.Run; | |
| 54 | -end. | |
| 55 | - |
ktwsapi/delphi/examples/KTWSAPIExamples.res deleted
No preview for this file type
ktwsapi/delphi/examples/uFolderContentExample.dfm deleted
| 1 | -object FolderContentExample: TFolderContentExample | |
| 2 | - Left = 0 | |
| 3 | - Top = 0 | |
| 4 | - Caption = 'FolderContentExample' | |
| 5 | - ClientHeight = 538 | |
| 6 | - ClientWidth = 219 | |
| 7 | - Color = clBtnFace | |
| 8 | - Font.Charset = DEFAULT_CHARSET | |
| 9 | - Font.Color = clWindowText | |
| 10 | - Font.Height = -11 | |
| 11 | - Font.Name = 'Tahoma' | |
| 12 | - Font.Style = [] | |
| 13 | - OldCreateOrder = False | |
| 14 | - PixelsPerInch = 96 | |
| 15 | - TextHeight = 13 | |
| 16 | - object tvFolderList: TTreeView | |
| 17 | - AlignWithMargins = True | |
| 18 | - Left = 3 | |
| 19 | - Top = 34 | |
| 20 | - Width = 213 | |
| 21 | - Height = 501 | |
| 22 | - Align = alClient | |
| 23 | - Images = ImageList4 | |
| 24 | - Indent = 19 | |
| 25 | - TabOrder = 0 | |
| 26 | - OnCollapsed = tvFolderListCollapsed | |
| 27 | - OnExpanded = tvFolderListExpanded | |
| 28 | - end | |
| 29 | - object Button1: TButton | |
| 30 | - AlignWithMargins = True | |
| 31 | - Left = 3 | |
| 32 | - Top = 3 | |
| 33 | - Width = 213 | |
| 34 | - Height = 25 | |
| 35 | - Align = alTop | |
| 36 | - Caption = 'Populate folders' | |
| 37 | - TabOrder = 1 | |
| 38 | - OnClick = Button1Click | |
| 39 | - end | |
| 40 | - object ImageList4: TImageList | |
| 41 | - Left = 8 | |
| 42 | - Top = 496 | |
| 43 | - Bitmap = { | |
| 44 | - 494C010102000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 | |
| 45 | - 0000000000003600000028000000400000001000000001002000000000000010 | |
| 46 | - 00000000000000000000000000000000000000000000078DBE00078DBE00078D | |
| 47 | - BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 48 | - BE00078DBE00078DBE00000000000000000000000000078DBE00078DBE00078D | |
| 49 | - BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 50 | - BE00078DBE000000000000000000000000000000000000000000000000000000 | |
| 51 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 52 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 53 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 54 | - 000000000000000000000000000000000000078DBE0063CBF800078DBE00A3E1 | |
| 55 | - FB0066CDF90065CDF80065CDF90065CDF90065CDF80065CDF90065CDF80066CD | |
| 56 | - F8003AADD800ACE7F500078DBE0000000000078DBE0025A1D10071C6E80084D7 | |
| 57 | - FA0066CDF90065CDF90065CDF90065CDF90065CDF80065CDF90065CDF80066CE | |
| 58 | - F9003AADD8001999C90000000000000000000000000000000000000000000000 | |
| 59 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 60 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 61 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 62 | - 000000000000000000000000000000000000078DBE006AD1F900078DBE00A8E5 | |
| 63 | - FC006FD4FA006FD4F9006ED4FA006FD4F9006FD4FA006FD4FA006FD4FA006ED4 | |
| 64 | - F9003EB1D900B1EAF500078DBE0000000000078DBE004CBCE70039A8D100A0E2 | |
| 65 | - FB006FD4FA006FD4F9006ED4FA006FD4F9006FD4FA006FD4FA006FD4FA006ED4 | |
| 66 | - F9003EB1D900C9F0F300078DBE00000000000000000000000000000000000000 | |
| 67 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 68 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 69 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 70 | - 000000000000000000000000000000000000078DBE0072D6FA00078DBE00AEEA | |
| 71 | - FC0079DCFB0079DCFB0079DCFB0079DCFB0079DCFB007ADCFB0079DCFA0079DC | |
| 72 | - FA0044B5D900B6EEF600078DBE0000000000078DBE0072D6FA00078DBE00AEE9 | |
| 73 | - FC0079DCFB0079DCFB0079DCFB0079DCFB0079DCFB007ADCFB0079DCFA0079DC | |
| 74 | - FA0044B5D900C9F0F300078DBE00000000000000000000000000000000000000 | |
| 75 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 76 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 77 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 78 | - 000000000000000000000000000000000000078DBE0079DDFB00078DBE00B5EE | |
| 79 | - FD0083E4FB0084E4FB0083E4FC0083E4FC0084E4FC0083E4FC0083E4FB0084E5 | |
| 80 | - FC0048B9DA00BBF2F600078DBE0000000000078DBE0079DDFB001899C7009ADF | |
| 81 | - F30092E7FC0084E4FB0083E4FC0083E4FC0084E4FC0083E4FC0083E4FB0084E5 | |
| 82 | - FC0048B9DA00C9F0F3001496C400000000000000000000000000000000000000 | |
| 83 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 84 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 85 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 86 | - 000000000000000000000000000000000000078DBE0082E3FC00078DBE00BAF3 | |
| 87 | - FD008DEBFC008DEBFC008DEBFC008DEBFD008DEBFD008DEBFC008DEBFD008DEB | |
| 88 | - FC004CBBDA00BEF4F700078DBE0000000000078DBE0082E3FC0043B7DC0065C2 | |
| 89 | - E000ABF0FC008DEBFC008DEBFC008DEBFD008DEBFD008DEBFC008DEBFD008DEB | |
| 90 | - FC004CBBDA00C9F0F300C9F0F300078DBE000000000000000000000000000000 | |
| 91 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 92 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 93 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 94 | - 000000000000000000000000000000000000078DBE008AEAFC00078DBE00FFFF | |
| 95 | - FF00C9F7FE00C8F7FE00C9F7FE00C9F7FE00C9F7FE00C8F7FE00C9F7FE00C8F7 | |
| 96 | - FE009BD5E700DEF9FB00078DBE0000000000078DBE008AEAFC0077DCF300219C | |
| 97 | - C700FEFFFF00C8F7FD00C9F7FD00C9F7FD00C9F7FE00C8F7FE00C9F7FD00C8F7 | |
| 98 | - FE009BD5E600EAFEFE00D2F3F800078DBE000000000000000000000000000000 | |
| 99 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 100 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 101 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 102 | - 000000000000000000000000000000000000078DBE0093F0FE00078DBE00078D | |
| 103 | - BE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 104 | - BE00078DBE00078DBE00078DBE0000000000078DBE0093F0FE0093F0FD001697 | |
| 105 | - C500078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 106 | - BE00078DBE00078DBE00078DBE00078DBE000000000000000000000000000000 | |
| 107 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 108 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 109 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 110 | - 000000000000000000000000000000000000078DBE009BF5FE009AF6FE009AF6 | |
| 111 | - FE009BF5FD009BF6FE009AF6FE009BF5FE009AF6FD009BF5FE009AF6FE009AF6 | |
| 112 | - FE000989BA00000000000000000000000000078DBE009BF5FE009AF6FE009AF6 | |
| 113 | - FE009BF5FD009BF6FE009AF6FE009BF5FE009AF6FD009BF5FE009AF6FE009AF6 | |
| 114 | - FE000989BA000000000000000000000000000000000000000000000000000000 | |
| 115 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 116 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 117 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 118 | - 000000000000000000000000000000000000078DBE00FEFEFE00A0FBFF00A0FB | |
| 119 | - FE00A0FBFE00A1FAFE00A1FBFE00A0FAFE00A1FBFE00A1FBFF00A0FBFF00A1FB | |
| 120 | - FF000989BA00000000000000000000000000078DBE00FEFEFE00A0FBFF00A0FB | |
| 121 | - FE00A0FBFE00A1FAFE00A1FBFE00A0FAFE00A1FBFE00A1FBFF00A0FBFF00A1FB | |
| 122 | - FF000989BA000000000000000000000000000000000000000000000000000000 | |
| 123 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 124 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 125 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 126 | - 00000000000000000000000000000000000000000000078DBE00FEFEFE00A5FE | |
| 127 | - FF00A5FEFF00A5FEFF00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 128 | - BE000000000000000000000000000000000000000000078DBE00FEFEFE00A5FE | |
| 129 | - FF00A5FEFF00A5FEFF00078DBE00078DBE00078DBE00078DBE00078DBE00078D | |
| 130 | - BE00000000000000000000000000000000000000000000000000000000000000 | |
| 131 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 132 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 133 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 134 | - 0000000000000000000000000000000000000000000000000000078DBE00078D | |
| 135 | - BE00078DBE00078DBE0000000000000000000000000000000000000000000000 | |
| 136 | - 0000000000000000000000000000000000000000000000000000078DBE00078D | |
| 137 | - BE00078DBE00078DBE0000000000000000000000000000000000000000000000 | |
| 138 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 139 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 140 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 141 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 142 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 143 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 144 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 145 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 146 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 147 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 148 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 149 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 150 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 151 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 152 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 153 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 154 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 155 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 156 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 157 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 158 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 159 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 160 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 161 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 162 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 163 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 164 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 165 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 166 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 167 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 168 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 169 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 170 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 171 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 172 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 173 | - 0000000000000000000000000000000000000000000000000000000000000000 | |
| 174 | - 000000000000000000000000000000000000424D3E000000000000003E000000 | |
| 175 | - 2800000040000000100000000100010000000000800000000000000000000000 | |
| 176 | - 000000000000000000000000FFFFFF0080038007000000000001000300000000 | |
| 177 | - 0001000100000000000100010000000000010001000000000001000000000000 | |
| 178 | - 0001000000000000000100000000000000070007000000000007000700000000 | |
| 179 | - 800F800F00000000C3FFC3FF00000000FFFFFFFF00000000FFFFFFFF00000000 | |
| 180 | - FFFFFFFF00000000FFFFFFFF0000000000000000000000000000000000000000 | |
| 181 | - 000000000000} | |
| 182 | - end | |
| 183 | -end |
ktwsapi/delphi/examples/uFolderContentExample.pas deleted
| 1 | -unit uFolderContentExample; | |
| 2 | - | |
| 3 | -interface | |
| 4 | - | |
| 5 | -uses | |
| 6 | - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | |
| 7 | - Dialogs, uKtwsapi, uWebService, ImgList, ComCtrls, StdCtrls; | |
| 8 | - | |
| 9 | -type | |
| 10 | - TFolderContentExample = class(TForm) | |
| 11 | - tvFolderList: TTreeView; | |
| 12 | - ImageList4: TImageList; | |
| 13 | - Button1: TButton; | |
| 14 | - procedure Button1Click(Sender: TObject); | |
| 15 | - procedure tvFolderListCollapsed(Sender: TObject; Node: TTreeNode); | |
| 16 | - procedure tvFolderListExpanded(Sender: TObject; Node: TTreeNode); | |
| 17 | - private | |
| 18 | - { Private declarations } | |
| 19 | - FIsPopulating: Boolean; | |
| 20 | - procedure PopulateTreeView(items: kt_folder_items; | |
| 21 | - parent: TTreeNode; tv: TTreeView); | |
| 22 | - public | |
| 23 | - { Public declarations } | |
| 24 | - end; | |
| 25 | - | |
| 26 | -var | |
| 27 | - FolderContentExample: TFolderContentExample; | |
| 28 | - UserName, Password: String; | |
| 29 | - | |
| 30 | -implementation | |
| 31 | - | |
| 32 | -{$R *.dfm} | |
| 33 | - | |
| 34 | -procedure TFolderContentExample.Button1Click(Sender: TObject); | |
| 35 | -var | |
| 36 | - ktapi: TKTWSAPI; | |
| 37 | - folder: TKTWSAPI_Folder; | |
| 38 | - contents: kt_folder_contents; | |
| 39 | -begin | |
| 40 | - if FIsPopulating then Exit; | |
| 41 | - | |
| 42 | - Screen.Cursor := crHourglass; | |
| 43 | - | |
| 44 | - FIsPopulating := True; | |
| 45 | - ktapi := TKTWSAPI.Create; | |
| 46 | - try | |
| 47 | - ktapi.SetDownloadPath(ExtractFileDir(Application.ExeName)); | |
| 48 | - ktapi.StartSession(UserName,Password); | |
| 49 | - | |
| 50 | - folder:= ktapi.GetRootFolder; | |
| 51 | - try | |
| 52 | - contents := folder.GetListing(10); | |
| 53 | - try | |
| 54 | - PopulateTreeView(contents.items, nil, tvFolderList); | |
| 55 | - finally | |
| 56 | - contents.Free; | |
| 57 | - end; | |
| 58 | - finally | |
| 59 | - folder.Free; | |
| 60 | - end; | |
| 61 | - | |
| 62 | - ktapi.Logout; | |
| 63 | - finally | |
| 64 | - ktapi.Free; | |
| 65 | - Screen.Cursor := crDefault; | |
| 66 | - FIsPopulating := False; | |
| 67 | - end; | |
| 68 | -end; | |
| 69 | - | |
| 70 | -procedure TFolderContentExample.PopulateTreeView(items: kt_folder_items; parent: TTreeNode; | |
| 71 | - tv: TTreeView); | |
| 72 | -var | |
| 73 | - I: Integer; | |
| 74 | - node: TTreeNode; | |
| 75 | - it: kt_folder_item; | |
| 76 | -begin | |
| 77 | - for I := 0 to Length(items) - 1 do | |
| 78 | - begin | |
| 79 | - it := items[i]; | |
| 80 | - if it.item_type <> 'F' then Continue; | |
| 81 | - node := tv.Items.AddChild(parent, it.title); | |
| 82 | - node.ImageIndex := 0; | |
| 83 | - node.Data := it; | |
| 84 | - if (Length(it.items) > 0) then | |
| 85 | - PopulateTreeView(it.items, node, tv); | |
| 86 | - end; | |
| 87 | -end; | |
| 88 | - | |
| 89 | -procedure TFolderContentExample.tvFolderListCollapsed(Sender: TObject; | |
| 90 | - Node: TTreeNode); | |
| 91 | -begin | |
| 92 | - Node.ImageIndex := 0; | |
| 93 | -end; | |
| 94 | - | |
| 95 | -procedure TFolderContentExample.tvFolderListExpanded(Sender: TObject; | |
| 96 | - Node: TTreeNode); | |
| 97 | -begin | |
| 98 | - Node.ImageIndex := 1; | |
| 99 | -end; | |
| 100 | - | |
| 101 | -initialization | |
| 102 | - UserName := 'xxxx'; | |
| 103 | - Password := 'xxxx'; | |
| 104 | - uktwsapi.KTWebServerUrl := 'http://ktdms.trunk'; | |
| 105 | - uktwsapi.KTWebServiceUrl := uktwsapi.KTWebServerUrl+'/ktwebservice/webservice.php?wsdl'; | |
| 106 | - uktwsapi.KTUploadUrl := uktwsapi.KTWebServerUrl+'/ktwebservice/upload.php'; | |
| 107 | - | |
| 108 | -end. |
ktwsapi/delphi/uPHPserialize.pas deleted
| 1 | -{ | |
| 2 | - Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd. | |
| 3 | - | |
| 4 | - All rights reserved. | |
| 5 | - | |
| 6 | - Redistribution and use in source and binary forms, with or without | |
| 7 | - modification, are permitted provided that the following conditions are met: | |
| 8 | - | |
| 9 | - i) Redistributions of source code must retain the above copyright notice, | |
| 10 | - this list of conditions and the following disclaimer. | |
| 11 | - ii) Redistributions in binary form must reproduce the above copyright | |
| 12 | - notice, this list of conditions and the following disclaimer in the | |
| 13 | - documentation and/or other materials provided with the distribution. | |
| 14 | - iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 15 | - names of its contributors may be used to endorse or promote products | |
| 16 | - derived from this software without specific prior written permission. | |
| 17 | - | |
| 18 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 | - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 22 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 23 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 24 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 25 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 26 | - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 27 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 28 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | -} | |
| 30 | - | |
| 31 | -{* | |
| 32 | - A helper unit to unserialize a php serialized string | |
| 33 | - | |
| 34 | - Inspired by the various implementaions presented here | |
| 35 | - http://www.phpguru.org/static/PHP_Unserialize.html | |
| 36 | - | |
| 37 | - @Author Bjarte Kalstveit Vebjørnsen <bjarte@macaos.com> | |
| 38 | - @Version 1.0 BKV 24.09.2007 Initial revision | |
| 39 | - @Todo A complementary serializing function would be nice | |
| 40 | -*} | |
| 41 | - | |
| 42 | -unit uPHPSerialize; | |
| 43 | - | |
| 44 | -interface | |
| 45 | - | |
| 46 | -uses | |
| 47 | - Classes, SysUtils, Variants, ComCtrls; | |
| 48 | - | |
| 49 | -type | |
| 50 | - TPHPValue = class; | |
| 51 | - TPHPArray = class; | |
| 52 | - TPHPSerialize = class; | |
| 53 | - | |
| 54 | - /// a single hash element | |
| 55 | - TPHPHashElement = record | |
| 56 | - Key: TPHPValue; /// The Key part of the element | |
| 57 | - Value: TPHPValue; /// The Value part of the element | |
| 58 | - end; | |
| 59 | - | |
| 60 | - /// an array of hash elements | |
| 61 | - TPHPHashedElementArray = array of TPHPHashElement; | |
| 62 | - | |
| 63 | - /// Tries to replicate a php array by accessing values through strings | |
| 64 | - /// @Todo: Add support for numeric keys | |
| 65 | - TPHPArray = class | |
| 66 | - private | |
| 67 | - FElements: TPHPHashedElementArray; /// array of hash elements | |
| 68 | - function GetValue(Key: string): TPHPValue; overload; | |
| 69 | - function GetValue(Key: TPHPValue): TPHPValue; overload; | |
| 70 | - procedure SetValue(Key: TPHPValue; VValue: TPHPValue); overload; | |
| 71 | - function GetCount: Integer; | |
| 72 | - function Getempty: Boolean; | |
| 73 | - public | |
| 74 | - property Value[Key: string]: TPHPValue read GetValue; default; | |
| 75 | - property Value[Key: TPHPValue]: TPHPValue read GetValue write SetValue; default; | |
| 76 | - property Count: Integer read GetCount; | |
| 77 | - property Empty: Boolean read Getempty; | |
| 78 | - procedure Clear; | |
| 79 | - constructor Create; | |
| 80 | - destructor Destroy; override; | |
| 81 | - end; | |
| 82 | - | |
| 83 | - /// Tries to represent a PHP value of any type | |
| 84 | - TPHPValue = class | |
| 85 | - private | |
| 86 | - FObj: TObject; /// Holds value if it's an object or array | |
| 87 | - FValue: String; /// Holds value if it's something else | |
| 88 | - procedure Clear; | |
| 89 | - public | |
| 90 | - constructor Create(Value: TObject); overload; | |
| 91 | - constructor Create(Value: String); overload; | |
| 92 | - destructor Destroy; override; | |
| 93 | - function AsString: String; | |
| 94 | - function AsDouble: Double; | |
| 95 | - function AsInteger: Integer; | |
| 96 | - function AsObject: TObject; | |
| 97 | - function AsArray: TPHPArray; | |
| 98 | - function AsBoolean: Boolean; | |
| 99 | - end; | |
| 100 | - | |
| 101 | - /// Class for unserializing a php serialized string | |
| 102 | - TPHPSerialize = class | |
| 103 | - private | |
| 104 | - function GetLength(Data: String): Integer; | |
| 105 | - function GetIntLength(Value: Integer): Integer; | |
| 106 | - public | |
| 107 | - class function Unserialize(Data: String): TPHPValue; | |
| 108 | - function _Unserialize(var Data: String): TPHPValue; | |
| 109 | - end; | |
| 110 | - | |
| 111 | -implementation | |
| 112 | - | |
| 113 | -{ TPHPSerialize } | |
| 114 | - | |
| 115 | -{* | |
| 116 | - Finds the length of they to the type | |
| 117 | - | |
| 118 | - @param string Data | |
| 119 | - @return integer | |
| 120 | -*} | |
| 121 | -function TPHPSerialize.GetLength(Data: String): Integer; | |
| 122 | -begin | |
| 123 | - Data := Copy(Data, 3, Length(Data)); | |
| 124 | - | |
| 125 | - Result := StrToIntDef(Copy(Data, 0, Pos(':', Data)-1), 0); | |
| 126 | -end; | |
| 127 | - | |
| 128 | -{* | |
| 129 | - Finds the lenght of the character-space the value occupies | |
| 130 | - | |
| 131 | - @param integer Value | |
| 132 | - @return Integer | |
| 133 | -*} | |
| 134 | -function TPHPSerialize.GetIntLength(Value: Integer): Integer; | |
| 135 | -begin | |
| 136 | - Result := Length(IntToStr(Value)); | |
| 137 | -end; | |
| 138 | - | |
| 139 | -{* | |
| 140 | - Helper function to use this class statically | |
| 141 | - | |
| 142 | - @param integer Value | |
| 143 | - @return Integer | |
| 144 | -*} | |
| 145 | -class function TPHPSerialize.Unserialize(Data: String): TPHPValue; | |
| 146 | -var | |
| 147 | - obj: TPHPSerialize; | |
| 148 | -begin | |
| 149 | - obj := TPHPSerialize.Create; | |
| 150 | - try | |
| 151 | - Result := obj._Unserialize(Data); | |
| 152 | - finally | |
| 153 | - obj.Free; | |
| 154 | - end; | |
| 155 | -end; | |
| 156 | - | |
| 157 | -{* | |
| 158 | - Recursing function for unserializing a string and creating a php value from it | |
| 159 | - | |
| 160 | - @see TPHPValue | |
| 161 | - @param Data String | |
| 162 | - @return TPHPValue | |
| 163 | -*} | |
| 164 | -function TPHPSerialize._Unserialize(var Data: String): TPHPValue; | |
| 165 | -var | |
| 166 | - I, Len: Integer; | |
| 167 | - Num: Double; | |
| 168 | - C: String; | |
| 169 | - Arr: TPHPArray; | |
| 170 | - Key, Value: TPHPValue; | |
| 171 | -begin | |
| 172 | - C := Copy(Data,0,1); | |
| 173 | - | |
| 174 | - if (C = 'a') then | |
| 175 | - begin | |
| 176 | - Len := GetLength(Data); | |
| 177 | - Data := Copy(Data, GetIntLength(Len) + 5, Length(Data) ); | |
| 178 | - | |
| 179 | - Arr := TPHPArray.Create; | |
| 180 | - for I := 0 to Len-1 do | |
| 181 | - begin | |
| 182 | - Key := _Unserialize(Data); | |
| 183 | - Value := _Unserialize(Data); | |
| 184 | - | |
| 185 | - Arr[Key] := Value; | |
| 186 | - end; | |
| 187 | - | |
| 188 | - Data := Copy(Data, Length(Data)); | |
| 189 | - Result := TPHPValue.Create(Arr); | |
| 190 | - | |
| 191 | - end else if (C = 's') then | |
| 192 | - begin | |
| 193 | - Len := GetLength(Data); | |
| 194 | - Result := TPHPValue.Create(Copy(Data, GetIntLength(Len) + 5, Len)); | |
| 195 | - Data := Copy(Data, GetIntLength(Len) + 7 + Len, Length(Data)); | |
| 196 | - end else if (C = 'i') or (C = 'd') then | |
| 197 | - begin | |
| 198 | - Num := StrToFloat(Copy(Data, 3, AnsiPos(';', Data)-3)); | |
| 199 | - Result := TPHPValue.Create(FloatToStr(Num)); | |
| 200 | - Data := Copy(Data, Length(FloatToStr(Num)) + 4, Length(Data)); | |
| 201 | - end else if (C = 'b') then | |
| 202 | - begin | |
| 203 | - Result := TPHPValue.Create(BoolToStr(Copy(Data, 3, 1) = '1')); | |
| 204 | - Data := Copy(Data, 4, Length(Data)); | |
| 205 | - end else if (C = 'O') or (C = 'r') or (C = 'C') or (C = 'R') | |
| 206 | - or (C = 'U') then | |
| 207 | - begin | |
| 208 | - raise Exception.Create('Unsupported PHP data type found!'); | |
| 209 | - end else if (C = 'N') then | |
| 210 | - begin | |
| 211 | - Result := TPHPValue.Create(nil); | |
| 212 | - Data := Copy(Data, 2, Length(Data)); | |
| 213 | - end else | |
| 214 | - begin | |
| 215 | - Result := TPHPValue.Create(nil); | |
| 216 | - Data := ''; | |
| 217 | - end; | |
| 218 | -end; | |
| 219 | - | |
| 220 | - | |
| 221 | -{ TPHPValue } | |
| 222 | - | |
| 223 | -{* | |
| 224 | - Returns value as boolan | |
| 225 | - | |
| 226 | - @return boolean value | |
| 227 | -*} | |
| 228 | -function TPHPValue.AsBoolean: Boolean; | |
| 229 | -begin | |
| 230 | - Result := StrToBool(FValue); | |
| 231 | -end; | |
| 232 | - | |
| 233 | -{* | |
| 234 | - Returns value as double | |
| 235 | - | |
| 236 | - @return double value | |
| 237 | -*} | |
| 238 | -function TPHPValue.AsDouble: Double; | |
| 239 | -begin | |
| 240 | - Result := StrToFloat(FValue); | |
| 241 | -end; | |
| 242 | - | |
| 243 | -{* | |
| 244 | - Returns value as an associative-array | |
| 245 | - | |
| 246 | - @return associative-array | |
| 247 | -*} | |
| 248 | -function TPHPValue.AsArray: TPHPArray; | |
| 249 | -begin | |
| 250 | - Result := nil; | |
| 251 | - Assert(Assigned(FObj)); | |
| 252 | - | |
| 253 | - if (FObj.ClassType = TPHPArray) then | |
| 254 | - Result := TPHPArray(FObj); | |
| 255 | -end; | |
| 256 | - | |
| 257 | -{* | |
| 258 | - Returns value as an integer | |
| 259 | - | |
| 260 | - @return integer value | |
| 261 | -*} | |
| 262 | -function TPHPValue.AsInteger: Integer; | |
| 263 | -begin | |
| 264 | - Result := StrToInt(FValue); | |
| 265 | -end; | |
| 266 | - | |
| 267 | -{* | |
| 268 | - Returns value as an object | |
| 269 | - | |
| 270 | - @return object value | |
| 271 | -*} | |
| 272 | -function TPHPValue.AsObject: TObject; | |
| 273 | -begin | |
| 274 | - Assert(Assigned(FObj)); | |
| 275 | - Result := FObj; | |
| 276 | -end; | |
| 277 | - | |
| 278 | -{* | |
| 279 | - Returns value as a string | |
| 280 | - | |
| 281 | - @return string value | |
| 282 | -*} | |
| 283 | -function TPHPValue.AsString: String; | |
| 284 | -begin | |
| 285 | - Result := FValue; | |
| 286 | -end; | |
| 287 | - | |
| 288 | -{* | |
| 289 | - Constructor | |
| 290 | - | |
| 291 | - @param Value Value to store | |
| 292 | -*} | |
| 293 | -constructor TPHPValue.Create(Value: String); | |
| 294 | -begin | |
| 295 | - Clear; | |
| 296 | - FValue := Value; | |
| 297 | -end; | |
| 298 | - | |
| 299 | -{* | |
| 300 | - Constructor | |
| 301 | - | |
| 302 | - @param Value Value to store | |
| 303 | -*} | |
| 304 | -constructor TPHPValue.Create(Value: TObject); | |
| 305 | -begin | |
| 306 | - Clear; | |
| 307 | - FObj := Value; | |
| 308 | -end; | |
| 309 | - | |
| 310 | -{* | |
| 311 | - Clears current value | |
| 312 | -*} | |
| 313 | -procedure TPHPValue.Clear; | |
| 314 | -begin | |
| 315 | - FValue := ''; | |
| 316 | - if Assigned(FObj) then FObj.Free; | |
| 317 | - FObj := nil; | |
| 318 | -end; | |
| 319 | - | |
| 320 | -{* | |
| 321 | - Destructor | |
| 322 | -*} | |
| 323 | -destructor TPHPValue.Destroy; | |
| 324 | -begin | |
| 325 | - Clear; | |
| 326 | - inherited; | |
| 327 | -end; | |
| 328 | - | |
| 329 | -{ TPHPArray } | |
| 330 | - | |
| 331 | - | |
| 332 | -{* | |
| 333 | - Clears whole array | |
| 334 | -*} | |
| 335 | -procedure TPHPArray.Clear; | |
| 336 | -var | |
| 337 | - i: Integer; | |
| 338 | -begin | |
| 339 | - for i := 0 to GetCount - 1 do | |
| 340 | - begin | |
| 341 | - FElements[i].Key.Free; | |
| 342 | - FElements[i].Key := nil; | |
| 343 | - FElements[i].Value.Free; | |
| 344 | - FElements[i].Value := nil; | |
| 345 | - end; | |
| 346 | - SetLength(FElements, 0); | |
| 347 | -end; | |
| 348 | - | |
| 349 | -{* | |
| 350 | - Constructor | |
| 351 | -*} | |
| 352 | -constructor TPHPArray.Create; | |
| 353 | -begin | |
| 354 | - inherited; | |
| 355 | - Clear; | |
| 356 | -end; | |
| 357 | - | |
| 358 | -{* | |
| 359 | - Destructor | |
| 360 | -*} | |
| 361 | -destructor TPHPArray.Destroy; | |
| 362 | -begin | |
| 363 | - Clear; | |
| 364 | - inherited; | |
| 365 | -end; | |
| 366 | - | |
| 367 | -{* | |
| 368 | - Returns the number of items in the array | |
| 369 | - | |
| 370 | - @return number of items | |
| 371 | -*} | |
| 372 | -function TPHPArray.GetCount: Integer; | |
| 373 | -begin | |
| 374 | - Result := Length(FElements); | |
| 375 | -end; | |
| 376 | - | |
| 377 | -{* | |
| 378 | - Checks if the array is empty | |
| 379 | - | |
| 380 | - @return true | |
| 381 | -*} | |
| 382 | -function TPHPArray.Getempty: Boolean; | |
| 383 | -begin | |
| 384 | - Result := Length(FElements) = 0; | |
| 385 | -end; | |
| 386 | - | |
| 387 | -{* | |
| 388 | - Fetch a phpvalue from the array | |
| 389 | - | |
| 390 | - @param Key Handle to phpvalue | |
| 391 | - @return handle to phpvalue | |
| 392 | -*} | |
| 393 | -function TPHPArray.GetValue(Key: TPHPValue): TPHPValue; | |
| 394 | -begin | |
| 395 | - Result := GetValue(Key.FValue); | |
| 396 | -end; | |
| 397 | - | |
| 398 | -{* | |
| 399 | - Fetch a phpvalue from the array | |
| 400 | - | |
| 401 | - @param Key Index to element | |
| 402 | - @return handle to phpvalue | |
| 403 | -*} | |
| 404 | -function TPHPArray.GetValue(Key: string): TPHPValue; | |
| 405 | -var | |
| 406 | - i: Integer; | |
| 407 | - r: Boolean; | |
| 408 | -begin | |
| 409 | - Result := nil; | |
| 410 | - i := 0; | |
| 411 | - r := False; | |
| 412 | - while (i < Length(FElements)) and (not r) do | |
| 413 | - begin | |
| 414 | - if AnsiUpperCase(FElements[i].key.AsString) = AnsiUpperCase(Key) then | |
| 415 | - begin | |
| 416 | - Result := FElements[i].Value; | |
| 417 | - r := True; | |
| 418 | - end; | |
| 419 | - i := i + 1; | |
| 420 | - end; | |
| 421 | -end; | |
| 422 | - | |
| 423 | -{* | |
| 424 | - Insert a phpvalue into the array | |
| 425 | - | |
| 426 | - @param Key Index to element | |
| 427 | - @return handle to phpvalue | |
| 428 | -*} | |
| 429 | -procedure TPHPArray.SetValue(Key, VValue: TPHPValue); | |
| 430 | -var | |
| 431 | - i, j: Integer; | |
| 432 | - r: Boolean; | |
| 433 | - E: TPHPHashedElementArray; | |
| 434 | -begin | |
| 435 | - if VValue <> nil then | |
| 436 | - begin | |
| 437 | - i := 0; | |
| 438 | - r := False; | |
| 439 | - while (i < Length(FElements)) and not r do | |
| 440 | - begin | |
| 441 | - if AnsiUpperCase(FElements[i].key.AsString) = AnsiUpperCase(Key.AsString) then | |
| 442 | - begin | |
| 443 | - FElements[i].Value := VValue; | |
| 444 | - r := True; | |
| 445 | - end; | |
| 446 | - i := i + 1; | |
| 447 | - end; | |
| 448 | - if not r then | |
| 449 | - begin | |
| 450 | - SetLength(FElements, Length(FElements) + 1); | |
| 451 | - FElements[Length(FElements) - 1].Key := Key; | |
| 452 | - FElements[Length(FElements) - 1].Value := Vvalue; | |
| 453 | - end; | |
| 454 | - end; | |
| 455 | - | |
| 456 | - SetLength(E, Length(FElements)); | |
| 457 | - for i := 0 to Length(FElements) - 1 do E[i] := FElements[i]; | |
| 458 | - SetLength(FElements, 0); | |
| 459 | - for i := 0 to Length(E) - 1 do if (E[i].Key.AsString <> '') | |
| 460 | - and (E[i].Value <> nil) then | |
| 461 | - begin | |
| 462 | - j := Length(FElements); | |
| 463 | - setlength(FElements, j + 1); | |
| 464 | - FElements[j] := E[i]; | |
| 465 | - end; | |
| 466 | -end; | |
| 467 | - | |
| 468 | -end. | |
| 469 | - |
ktwsapi/delphi/uktwsapi.pas deleted
| 1 | -{ | |
| 2 | - Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd. | |
| 3 | - | |
| 4 | - All rights reserved. | |
| 5 | - | |
| 6 | - Redistribution and use in source and binary forms, with or without | |
| 7 | - modification, are permitted provided that the following conditions are met: | |
| 8 | - | |
| 9 | - i) Redistributions of source code must retain the above copyright notice, | |
| 10 | - this list of conditions and the following disclaimer. | |
| 11 | - ii) Redistributions in binary form must reproduce the above copyright | |
| 12 | - notice, this list of conditions and the following disclaimer in the | |
| 13 | - documentation and/or other materials provided with the distribution. | |
| 14 | - iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 15 | - names of its contributors may be used to endorse or promote products | |
| 16 | - derived from this software without specific prior written permission. | |
| 17 | - | |
| 18 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 | - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 22 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 23 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 24 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 25 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 26 | - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 27 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 28 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | -} | |
| 30 | - | |
| 31 | -{* | |
| 32 | - This is a Delphi port of the php api for KnowledgeTree WebService. | |
| 33 | - | |
| 34 | - @Author Bjarte Kalstveit Vebjørnsen <bjarte@macaos.com> | |
| 35 | - @Version 1.0 BKV 24.09.2007 Initial revision | |
| 36 | -*} | |
| 37 | - | |
| 38 | -unit uktwsapi; | |
| 39 | - | |
| 40 | -interface | |
| 41 | - | |
| 42 | -uses | |
| 43 | - Classes, SysUtils, SOAPHTTPClient, uwebservice; | |
| 44 | - | |
| 45 | -type | |
| 46 | - | |
| 47 | - /// Base exception class | |
| 48 | - EKTWSAPI_Exception = class(Exception); | |
| 49 | - | |
| 50 | - TKTWSAPI_FolderItem = class; | |
| 51 | - TKTWSAPI_Folder = class; | |
| 52 | - TKTWSAPI_Document = class; | |
| 53 | - TKTWSAPI = class; | |
| 54 | - | |
| 55 | - /// Base class for documents and folders | |
| 56 | - TKTWSAPI_FolderItem = class(TObject) | |
| 57 | - private | |
| 58 | - FKTAPI: TKTWSAPI; /// Handle to KTAPI object | |
| 59 | - FParentId: Integer; /// Id of parent folder | |
| 60 | - | |
| 61 | - function _GetFileSize(FileName: WideString): WideString; | |
| 62 | - function _UploadFile(FileName, Action: WideString; DocumentId: Integer = 0): WideString; | |
| 63 | - function _DownloadFile(Url, LocalPath, FileName: WideString): Boolean; | |
| 64 | - function _SaveBase64StringAsFile(Base64String, LocalPath, FileName: WideString): Boolean; | |
| 65 | - function _LoadFileAsBase64String(FileName: WideString): WideString; | |
| 66 | - | |
| 67 | - public | |
| 68 | - function GetParentFolder:TKTWSAPI_Folder; | |
| 69 | - end; | |
| 70 | - | |
| 71 | - /// Class representing a folder | |
| 72 | - TKTWSAPI_Folder = class(TKTWSAPI_FolderItem) | |
| 73 | - private | |
| 74 | - FFolderName, /// Name of folder | |
| 75 | - FFullPath: WideString; /// Full path to folder | |
| 76 | - | |
| 77 | - FFolderId: Integer; /// Id to folder | |
| 78 | - public | |
| 79 | - constructor Create(KTAPI:TKTWSAPI; FolderDetail: kt_folder_detail); overload; | |
| 80 | - class function Get(KTAPI: TKTWSAPI; FolderId:Integer): TKTWSAPI_Folder; | |
| 81 | - function GetParentFolderId: Integer; | |
| 82 | - function GetFolderName: WideString; | |
| 83 | - function GetFolderId: Integer; | |
| 84 | - function GetFolderByName(FolderName: WideString): TKTWSAPI_Folder; | |
| 85 | - function GetFullPath: WideString; | |
| 86 | - function GetListing(Depth: Integer=1; What: WideString = 'DF'): kt_folder_contents; | |
| 87 | - function GetDocumentByName(Title: WideString): TKTWSAPI_Document; | |
| 88 | - function GetDocumentByFileName(FileName: WideString): TKTWSAPI_Document; | |
| 89 | - function AddFolder(FolderName: WideString): TKTWSAPI_Folder; | |
| 90 | - function Delete(Reason: WideString): Boolean; | |
| 91 | - function Rename(NewName: WideString): Boolean; | |
| 92 | - function Move(TargetFolder:TKTWSAPI_Folder; Reason: WideString): Boolean; | |
| 93 | - function Copy(TargetFolder:TKTWSAPI_Folder; Reason: WideString): Boolean; | |
| 94 | - function AddDocument(FileName: WideString; Title: WideString = ''; | |
| 95 | - DocumentType: WideString = ''): TKTWSAPI_Document; | |
| 96 | - function AddDocumentBase64(FileName: WideString; Title: WideString = ''; | |
| 97 | - DocumentType: WideString = ''): TKTWSAPI_Document; | |
| 98 | - published | |
| 99 | - property FolderName: WideString read FFolderName write FFolderName; | |
| 100 | - property FullPath: WideString read FFullPath write FFullPath; | |
| 101 | - property FolderId: Integer read FFolderId write FFolderId; | |
| 102 | - end; | |
| 103 | - | |
| 104 | - /// Class representing a document | |
| 105 | - TKTWSAPI_Document = class(TKTWSAPI_FolderItem) | |
| 106 | - private | |
| 107 | - | |
| 108 | - FDocumentId: Integer; /// Id of document | |
| 109 | - FTitle, /// Title of document | |
| 110 | - FDocumentType, /// Type of document | |
| 111 | - FVersion, /// Document version | |
| 112 | - FFileName, /// Original filename | |
| 113 | - FCreatedDate, /// Date created | |
| 114 | - FCreatedBy, /// Name of user who created | |
| 115 | - FUpdatedDate, /// Date updated | |
| 116 | - FUpdatedBy, /// Name of user who updated | |
| 117 | - FWorkflow, /// Workflow | |
| 118 | - FWorkflowState, /// Workflow state | |
| 119 | - FCheckoutBy, /// Name of user who checked out | |
| 120 | - FFullPath: WideString; /// Full path to document | |
| 121 | - public | |
| 122 | - constructor Create(KTAPI: TKTWSAPI; DocumentDetail: kt_document_detail); | |
| 123 | - | |
| 124 | - class function Get(KTAPI: TKTWSAPI; DocumentId: Integer; | |
| 125 | - LoadInfo: Boolean = System.True): TKTWSAPI_Document; | |
| 126 | - function Checkin(FileName, Reason: WideString; MajorUpdate: Boolean): Boolean; | |
| 127 | - function Checkout(Reason: WideString; LocalPath: WideString = ''; | |
| 128 | - DownloadFile: Boolean = True): Boolean; | |
| 129 | - function UndoCheckout(Reason: WideString): Boolean; | |
| 130 | - function Download(Version: WideString = ''; LocalPath: WideString = ''; FileName: WideString = ''): Boolean; | |
| 131 | - function Delete(Reason: WideString): Boolean; | |
| 132 | - function ChangeOwner(UserName, Reason: WideString): Boolean; | |
| 133 | - function Copy(Folder: TKTWSAPI_Folder; Reason: WideString; | |
| 134 | - NewTitle: WideString = ''; NewFileName: WideString = ''): Boolean; | |
| 135 | - function Move(Folder: TKTWSAPI_Folder; Reason: WideString; | |
| 136 | - NewTitle: WideString = ''; NewFileName: WideString = ''): Boolean; | |
| 137 | - function ChangeDocumentType(DocumentType: WideString): Boolean; | |
| 138 | - function RenameTitle(NewTitle: WideString): Boolean; | |
| 139 | - function RenameFilename(NewFilename: WideString): Boolean; | |
| 140 | - function StartWorkflow(WorkFlow: WideString): Boolean; | |
| 141 | - function DeleteWorkflow: Boolean; | |
| 142 | - function PeformWorkflowTransition(Transition, Reason: WideString): Boolean; | |
| 143 | - function GetMetadata:kt_metadata_response; | |
| 144 | - function UpdateMetadata(Metadata: kt_metadata_fieldsets): Boolean; | |
| 145 | - function GetTransactionHistory: kt_document_transaction_history_response; | |
| 146 | - function GetVersionHistory: kt_document_version_history_response; | |
| 147 | - function GetLinks: kt_linked_document_response; | |
| 148 | - function Link(DocumentId: Integer; const LinkType: WideString): Boolean; | |
| 149 | - function Unlink(DocumentId: Integer): Boolean; | |
| 150 | - function CheckinBase64(FileName, Reason: WideString; MajorUpdate: Boolean): Boolean; | |
| 151 | - function CheckoutBase64(Reason: WideString; LocalPath: WideString = ''; | |
| 152 | - DownloadFile: Boolean = True): Boolean; | |
| 153 | - function DownloadBase64(Version: WideString = ''; LocalPath: WideString = ''): Boolean; | |
| 154 | - function GetTypes: kt_document_types_response; | |
| 155 | - function GetLinkTypes: kt_document_types_response; | |
| 156 | - | |
| 157 | - property DocumentId: Integer read FDocumentId write FDocumentId; | |
| 158 | - property Title: WideString read FTitle write FTitle; | |
| 159 | - property DocumentType: WideString read FDocumentType write FDocumentType; | |
| 160 | - property Version: WideString read FVersion write FVersion; | |
| 161 | - property FileName: WideString read FFileName write FFileName; | |
| 162 | - property CreatedDate: WideString read FCreatedBy write FCreatedBy; | |
| 163 | - property CreatedBy: WideString read FCreatedBy write FCreatedBy; | |
| 164 | - property UpdatedDate: WideString read FUpdatedDate write FUpdatedDate; | |
| 165 | - property UpdatedBy: WideString read FUpdatedBy write FUpdatedBy; | |
| 166 | - property Workflow: WideString read FWorkflow write FWorkflow; | |
| 167 | - property WorkflowState: WideString read FWorkflowState write FWorkflowState; | |
| 168 | - property CheckoutBy: WideString read FCheckoutBy write FCheckoutBy; | |
| 169 | - property FullPath: WideString read FFullPath write FFullPath; | |
| 170 | - end; | |
| 171 | - | |
| 172 | - /// Api entry point | |
| 173 | - TKTWSAPI = class | |
| 174 | - private | |
| 175 | - | |
| 176 | - FSession, /// Current session id | |
| 177 | - FDownloadPath: WideString; /// Current download path | |
| 178 | - | |
| 179 | - FSoapClient:KnowledgeTreePort; /// Object implementing the | |
| 180 | - /// KnowledgeTreePort interface | |
| 181 | - public | |
| 182 | - constructor Create(); | |
| 183 | - function GetDownloadPath: WideString; | |
| 184 | - function SetDownloadPath(DownloadPath:WideString): Boolean; | |
| 185 | - function StartAnonymousSession(Ip: WideString = ''): WideString; | |
| 186 | - function StartSession(Username, Password: WideString; Ip: WideString = ''): WideString; | |
| 187 | - function ActiveSession(Session: WideString; Ip: WideString = ''): WideString; | |
| 188 | - function Logout: Boolean; | |
| 189 | - function GetRootFolder: TKTWSAPI_Folder; | |
| 190 | - function GetFolderById(FolderId: Integer): TKTWSAPI_Folder; | |
| 191 | - function GetDocumentById(DocumentId: Integer): TKTWSAPI_Document; | |
| 192 | - published | |
| 193 | - property SoapClient: KnowledgeTreePort read FSoapClient write FSoapClient; | |
| 194 | - property Session: WideString read FSession write FSession; | |
| 195 | - end; | |
| 196 | -var | |
| 197 | - KTWebServerUrl: WideString; /// Your webserver url | |
| 198 | - KTUploadUrl: WideString; /// URL to the web-service upload.php | |
| 199 | - KTWebServiceUrl: WideString; /// URL to the web-service wsdl | |
| 200 | - | |
| 201 | -implementation | |
| 202 | - | |
| 203 | -uses | |
| 204 | - IdComponent, IdURI, IdHttp, IdMultipartFormData, IdGlobalProtocols, | |
| 205 | - uPHPSerialize, EncdDecd; | |
| 206 | -const | |
| 207 | - KTWSAPI_ERR_SESSION_IN_USE = | |
| 208 | - 'There is a session already active.'; /// Exception message when session is in use | |
| 209 | - KTWSAPI_ERR_SESSION_NOT_STARTED = | |
| 210 | - 'An active session has not been started.'; /// Exception message when session is not started | |
| 211 | - | |
| 212 | - | |
| 213 | -{ TKTWSAPI_FolderItem } | |
| 214 | - | |
| 215 | -{* | |
| 216 | - Finds the filesize of a file. | |
| 217 | - | |
| 218 | - @param FileName Path to the file | |
| 219 | - @return The size of the file as a string | |
| 220 | -*} | |
| 221 | -function TKTWSAPI_FolderItem._GetFileSize(FileName: WideString): WideString; | |
| 222 | -var | |
| 223 | - SearchRec: TSearchRec; | |
| 224 | - sgPath: string; | |
| 225 | - inRetval, I1: Integer; | |
| 226 | -begin | |
| 227 | - sgPath := ExpandFileName(FileName); | |
| 228 | - try | |
| 229 | - inRetval := FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec); | |
| 230 | - if inRetval = 0 then | |
| 231 | - I1 := SearchRec.Size | |
| 232 | - else | |
| 233 | - I1 := -1; | |
| 234 | - finally | |
| 235 | - SysUtils.FindClose(SearchRec); | |
| 236 | - end; | |
| 237 | - Result := IntToStr(I1); | |
| 238 | -end; | |
| 239 | - | |
| 240 | -{* | |
| 241 | - Reads a file into a string and base64 encodes it. | |
| 242 | - | |
| 243 | - @param Base64String Base64 encoded string | |
| 244 | - @param LocalPath Path to load from | |
| 245 | - @param FileName FileName to read | |
| 246 | - @return base64 encoded string | |
| 247 | - @throws EKTWSAPI_Exception 'Could not access file to read.' | |
| 248 | -*} | |
| 249 | -function TKTWSAPI_FolderItem._LoadFileAsBase64String(FileName: WideString): WideString; | |
| 250 | -var | |
| 251 | - Stream: TFileStream; | |
| 252 | - InString: AnsiString; | |
| 253 | -begin | |
| 254 | - if not FileExists(FileName) then | |
| 255 | - raise EKTWSAPI_Exception.Create('Could not access file to read.'); | |
| 256 | - Stream := TFileStream.Create(FileName, fmOpenRead); | |
| 257 | - try | |
| 258 | - SetLength(InString, Stream.Size); | |
| 259 | - Stream.ReadBuffer(InString[1], Length(InString)); | |
| 260 | - Result := EncodeString(InString); | |
| 261 | - finally | |
| 262 | - Stream.Free; | |
| 263 | - end; | |
| 264 | -end; | |
| 265 | - | |
| 266 | -{* | |
| 267 | - Save a Base64 encoded string as a file. | |
| 268 | - | |
| 269 | - @param Base64String Base64 encoded string | |
| 270 | - @param LocalPath Path to save to | |
| 271 | - @param FileName FileName to save as | |
| 272 | - @return true if success | |
| 273 | -*} | |
| 274 | -function TKTWSAPI_FolderItem._SaveBase64StringAsFile(Base64String, LocalPath, | |
| 275 | - FileName: WideString): Boolean; | |
| 276 | -var | |
| 277 | - OutString: AnsiString; | |
| 278 | - Stream: TFileStream; | |
| 279 | - LocalFileName: String; | |
| 280 | -begin | |
| 281 | - LocalFileName := LocalPath + '/' + FileName; | |
| 282 | - OutString := DecodeString(Base64String); | |
| 283 | - Stream := TFileStream.Create(LocalFileName, fmCreate); | |
| 284 | - try | |
| 285 | - // For some reason it fails if I use WideString instead of AnsiString | |
| 286 | - Stream.WriteBuffer(Pointer(OutString)^, Length(OutString)); | |
| 287 | - Result := true; | |
| 288 | - finally | |
| 289 | - Stream.Free; | |
| 290 | - end; | |
| 291 | -end; | |
| 292 | - | |
| 293 | -{* | |
| 294 | - Upload a file to KT. | |
| 295 | - | |
| 296 | - @param FileName Path to upload file | |
| 297 | - @param Action Which action to perform with the file (A = Add, C = Checkin) | |
| 298 | - @param DocumentId Id of the document | |
| 299 | - @return The temporary filename on the server | |
| 300 | - @throws EKTWSAPI_Exception Could not access file to upload. | |
| 301 | - @throws EKTWSAPI_Exception No response from server. | |
| 302 | - @throws EKTWSAPI_Exception Could not upload file. | |
| 303 | -*} | |
| 304 | -function TKTWSAPI_FolderItem._UploadFile(FileName, Action: WideString; | |
| 305 | - DocumentId: Integer): WideString; | |
| 306 | -var | |
| 307 | - UploadName, UploadStatus, SessionId, StatusCode: WideString; | |
| 308 | - PostStream: TIdMultiPartFormDataStream; | |
| 309 | - ResponseStream: TStringStream; | |
| 310 | - Fields: TStringList; | |
| 311 | - HTTP: TIdHTTP; | |
| 312 | - UploadData: TPHPValue; | |
| 313 | - FilesArr: TPHPArray; | |
| 314 | -begin | |
| 315 | - Result := ''; | |
| 316 | - if not FileExists(FileName) then | |
| 317 | - raise EKTWSAPI_Exception.Create('Could not access file to upload.'); | |
| 318 | - // TODO: Check if file is readable | |
| 319 | - | |
| 320 | - if (DocumentId = 0) then | |
| 321 | - UploadName := 'upload_document' | |
| 322 | - else | |
| 323 | - UploadName := 'upload_'+IntToStr(DocumentId); | |
| 324 | - SessionId := FKTAPI.Session; | |
| 325 | - | |
| 326 | - HTTP := TIdHttp.Create(nil); | |
| 327 | - try | |
| 328 | - PostStream := TIdMultiPartFormDataStream.Create; | |
| 329 | - ResponseStream := TStringStream.Create(''); | |
| 330 | - Fields := TStringList.Create; | |
| 331 | - try | |
| 332 | - PostStream.AddFormField('session_id', SessionId); | |
| 333 | - PostStream.AddFormField('action', Action); | |
| 334 | - PostStream.AddFormField('document_id',IntToStr(DocumentId)); | |
| 335 | - PostStream.AddFormField(UploadName,'@' + FileName); | |
| 336 | - PostStream.AddFile('file',FileName,GetMIMETypeFromFile(FileName)); | |
| 337 | - | |
| 338 | - HTTP.Request.ContentType := PostStream.RequestContentType; | |
| 339 | - HTTP.Post(KTUploadURL, PostStream, ResponseStream); | |
| 340 | - if (ResponseStream.DataString = '') then | |
| 341 | - raise EKTWSAPI_Exception.Create('No response from server.'); | |
| 342 | - ExtractStrings(['&'], [' '], pAnsiChar(ResponseStream.DataString), Fields); | |
| 343 | - | |
| 344 | - StatusCode := Copy(Fields[0], Pos('=',Fields[0])+1, 1); | |
| 345 | - if (StatusCode <> '0') then | |
| 346 | - raise EKTWSAPI_Exception.Create('Could not upload file.'); | |
| 347 | - | |
| 348 | - | |
| 349 | - UploadStatus := Copy(Fields[1], Pos('=',Fields[1])+1, Length(Fields[1])); | |
| 350 | - UploadStatus := TIdURI.URLDecode(UploadStatus); | |
| 351 | - UploadData := TPHPSerialize.Unserialize(TIdURI.URLDecode(UploadStatus)); | |
| 352 | - Assert(Assigned(UploadData)); | |
| 353 | - Assert(Assigned(UploadData.AsArray['file'])); | |
| 354 | - try | |
| 355 | - FilesArr := UploadData.AsArray['file'].AsArray; | |
| 356 | - | |
| 357 | - if (FilesArr['size'].AsString <> _GetFileSize(FileName)) then | |
| 358 | - raise EKTWSAPI_Exception.Create('Could not upload file.'); | |
| 359 | - | |
| 360 | - Result := FilesArr['tmp_name'].AsString; | |
| 361 | - finally | |
| 362 | - UploadData.Free; | |
| 363 | - end; | |
| 364 | - finally | |
| 365 | - PostStream.Free; | |
| 366 | - ResponseStream.Free; | |
| 367 | - Fields.Free; | |
| 368 | - end; | |
| 369 | - finally | |
| 370 | - HTTP.Free; | |
| 371 | - end; | |
| 372 | -end; | |
| 373 | - | |
| 374 | -{* | |
| 375 | - Downloads a file from KT. | |
| 376 | - | |
| 377 | - @param Url Http-url to download | |
| 378 | - @param LocalPath Path to save to | |
| 379 | - @param FileName FileName to save as | |
| 380 | - @return true if success | |
| 381 | - @throws EKTWSAPI_Exception Could not create local file | |
| 382 | -*} | |
| 383 | -function TKTWSAPI_FolderItem._DownloadFile(Url, LocalPath, | |
| 384 | - FileName: WideString): Boolean; | |
| 385 | -var | |
| 386 | - Stream: TMemoryStream; | |
| 387 | - LocalFileName: WideString; | |
| 388 | - FP: File; | |
| 389 | - HTTP: TIdHTTP; | |
| 390 | -begin | |
| 391 | - LocalFileName := LocalPath + '/' + FileName; | |
| 392 | - | |
| 393 | - AssignFile(FP, LocalFileName); | |
| 394 | - {$I-} | |
| 395 | - Rewrite(FP,1); | |
| 396 | - {$I+} | |
| 397 | - if (IOResult <> 0) then | |
| 398 | - raise EKTWSAPI_Exception.Create('Could not create local file'); | |
| 399 | - CloseFile(FP); | |
| 400 | - HTTP := TIdHttp.Create(Nil); | |
| 401 | - try | |
| 402 | - Stream := TMemoryStream.Create; | |
| 403 | - try | |
| 404 | - HTTP.Get(Url, Stream); | |
| 405 | - Stream.SaveToFile(LocalFileName); | |
| 406 | - Result := true; | |
| 407 | - finally | |
| 408 | - Stream.Free; | |
| 409 | - end; | |
| 410 | - finally | |
| 411 | - HTTP.Free; | |
| 412 | - end; | |
| 413 | -end; | |
| 414 | - | |
| 415 | -{* | |
| 416 | - Returns a reference to the parent folder. | |
| 417 | - | |
| 418 | - @return Handle to parent folder | |
| 419 | -*} | |
| 420 | -function TKTWSAPI_FolderItem.GetParentFolder: TKTWSAPI_Folder; | |
| 421 | -begin | |
| 422 | - Result := FKTAPI.GetFolderById(FParentId); | |
| 423 | -end; | |
| 424 | - | |
| 425 | - | |
| 426 | - { TKTWSAPI_Folder } | |
| 427 | - | |
| 428 | -{* | |
| 429 | - Constructor | |
| 430 | - | |
| 431 | - @param KTAPI Handle to KTAPI object | |
| 432 | - @param FolderDetail Handle to kt_folder_detail | |
| 433 | -*} | |
| 434 | -constructor TKTWSAPI_Folder.Create(KTAPI: TKTWSAPI; | |
| 435 | - FolderDetail: kt_folder_detail); | |
| 436 | -begin | |
| 437 | - FKTAPI := KTAPI; | |
| 438 | - FFolderId := FolderDetail.id; | |
| 439 | - FFolderName := FolderDetail.folder_name; | |
| 440 | - FParentId := FolderDetail.parent_id; | |
| 441 | - FFullPath := FolderDetail.full_path; | |
| 442 | -end; | |
| 443 | - | |
| 444 | -{* | |
| 445 | - Returns a reference to a TKTWSAPI_Folder | |
| 446 | - | |
| 447 | - @param KTAPI Handle to KTAPI object | |
| 448 | - @param FolderId Id of folder to fetch | |
| 449 | - @return folder handle | |
| 450 | - @throws EKTWSAPI_Exception Response message | |
| 451 | -*} | |
| 452 | -class function TKTWSAPI_Folder.Get(KTAPI: TKTWSAPI; | |
| 453 | - FolderId: Integer): TKTWSAPI_Folder; | |
| 454 | -var | |
| 455 | - FolderDetail: kt_folder_detail; | |
| 456 | -begin | |
| 457 | - Assert(Assigned(KTAPI)); | |
| 458 | - Assert(KTAPI.ClassNameIs('TKTWSAPI')); | |
| 459 | - Result := nil; | |
| 460 | - | |
| 461 | - FolderDetail := KTAPI.SoapClient.get_folder_detail(KTAPI.Session, FolderId); | |
| 462 | - try | |
| 463 | - if (FolderDetail.status_code <> 0) then | |
| 464 | - raise EKTWSAPI_Exception.Create(FolderDetail.message_); | |
| 465 | - | |
| 466 | - Result := TKTWSAPI_Folder.Create(KTAPI, FolderDetail); | |
| 467 | - | |
| 468 | - finally | |
| 469 | - FolderDetail.Free; | |
| 470 | - end; | |
| 471 | -end; | |
| 472 | - | |
| 473 | -{* | |
| 474 | - Returns the parent folder id. | |
| 475 | - | |
| 476 | - @return parent folder id | |
| 477 | -*} | |
| 478 | -function TKTWSAPI_Folder.GetParentFolderId: Integer; | |
| 479 | -begin | |
| 480 | - Result := FParentId; | |
| 481 | -end; | |
| 482 | - | |
| 483 | -{* | |
| 484 | - Returns the folder name. | |
| 485 | - | |
| 486 | - @return folder name | |
| 487 | -*} | |
| 488 | -function TKTWSAPI_Folder.GetFolderName: WideString; | |
| 489 | -begin | |
| 490 | - Result := FFolderName; | |
| 491 | -end; | |
| 492 | - | |
| 493 | -{* | |
| 494 | - Returns the current folder id. | |
| 495 | - | |
| 496 | - @return current folder id | |
| 497 | -*} | |
| 498 | -function TKTWSAPI_Folder.GetFolderId: Integer; | |
| 499 | -begin | |
| 500 | - Result := FFolderId; | |
| 501 | -end; | |
| 502 | - | |
| 503 | -{* | |
| 504 | - Returns the folder based on foldername. | |
| 505 | - | |
| 506 | - @param FolderName Name of folder | |
| 507 | - @return folder handle | |
| 508 | - @throws EKTWSAPI_Exception Response message | |
| 509 | -*} | |
| 510 | -function TKTWSAPI_Folder.GetFolderByName(FolderName: WideString): TKTWSAPI_Folder; | |
| 511 | -var | |
| 512 | - Path: WideString; | |
| 513 | - FolderDetail: kt_folder_detail; | |
| 514 | -begin | |
| 515 | - Path := FFullPath + '/' + FolderName; | |
| 516 | - if (System.Copy(Path, 0, 13) = '/Root Folder/') then | |
| 517 | - Path := System.Copy(Path, 13, Length(Path)-1); | |
| 518 | - if (System.Copy(Path, 0, 12) = 'Root Folder/') then | |
| 519 | - Path := System.Copy(Path, 12, Length(Path)-1); | |
| 520 | - | |
| 521 | - FolderDetail := FKTAPI.SoapClient.get_folder_detail_by_name(FKTAPI.Session, | |
| 522 | - Path); | |
| 523 | - | |
| 524 | - if (FolderDetail.status_code <> 0) then | |
| 525 | - raise EKTWSAPI_Exception.Create(FolderDetail.message_); | |
| 526 | - | |
| 527 | - Result := TKTWSAPI_Folder.Create(FKTAPI, FolderDetail); | |
| 528 | -end; | |
| 529 | - | |
| 530 | -{* | |
| 531 | - Returns the full folder path. | |
| 532 | - | |
| 533 | - @return Full folder path | |
| 534 | -*} | |
| 535 | -function TKTWSAPI_Folder.GetFullPath: WideString; | |
| 536 | -begin | |
| 537 | - Result := FFullPath; | |
| 538 | -end; | |
| 539 | - | |
| 540 | -{* | |
| 541 | - Returns the contents of a folder. | |
| 542 | - | |
| 543 | - @param Depth How many sub-folders to fetch | |
| 544 | - @param What to fetch (F=Folders, D=Documents, FD=Both) | |
| 545 | - @return folder contents handle | |
| 546 | - @throws EKTWSAPI_Exception Response message | |
| 547 | -*} | |
| 548 | -function TKTWSAPI_Folder.GetListing(Depth: Integer; | |
| 549 | - What: WideString): kt_folder_contents; | |
| 550 | -begin | |
| 551 | - Result := FKTAPI.SoapClient.get_folder_contents( | |
| 552 | - FKTAPI.Session, FFolderId, Depth, What); | |
| 553 | - | |
| 554 | - if (Result.status_code <> 0) then | |
| 555 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 556 | -end; | |
| 557 | - | |
| 558 | -{* | |
| 559 | - Returns a document based on title. | |
| 560 | - | |
| 561 | - @param Title Title of document | |
| 562 | - @return document handle | |
| 563 | - @throws EKTWSAPI_Exception Response message | |
| 564 | -*} | |
| 565 | -function TKTWSAPI_Folder.GetDocumentByName(Title: WideString): TKTWSAPI_Document; | |
| 566 | -var | |
| 567 | - Path: WideString; | |
| 568 | - DocumentDetail: kt_document_detail; | |
| 569 | -begin | |
| 570 | - Path := FFullPath + '/' + Title; | |
| 571 | - if (System.Copy(Path, 0, 13) = '/Root Folder/') then | |
| 572 | - Path := System.Copy(Path, 13, Length(Path)-1); | |
| 573 | - if (System.Copy(Path, 0, 12) = 'Root Folder/') then | |
| 574 | - Path := System.Copy(Path, 12, Length(Path)-1); | |
| 575 | - | |
| 576 | - DocumentDetail := FKTAPI.SoapClient.get_document_detail_by_name(FKTAPI.Session, | |
| 577 | - Path, 'T'); | |
| 578 | - | |
| 579 | - if (DocumentDetail.status_code <> 0) then | |
| 580 | - raise EKTWSAPI_Exception.Create(DocumentDetail.message_); | |
| 581 | - | |
| 582 | - Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail); | |
| 583 | -end; | |
| 584 | - | |
| 585 | -{* | |
| 586 | - Returns a document based on filename. | |
| 587 | - | |
| 588 | - @param FileName Name of file | |
| 589 | - @return document handle | |
| 590 | - @throws EKTWSAPI_Exception Response message | |
| 591 | -*} | |
| 592 | -function TKTWSAPI_Folder.GetDocumentByFileName( | |
| 593 | - FileName: WideString): TKTWSAPI_Document; | |
| 594 | -var | |
| 595 | - Path: WideString; | |
| 596 | - DocumentDetail: kt_document_detail; | |
| 597 | -begin | |
| 598 | - Result := nil; | |
| 599 | - Path := FFullPath + '/' + FileName; | |
| 600 | - if (System.Copy(Path, 0, 13) = '/Root Folder/') then | |
| 601 | - Path := System.Copy(Path, 13, Length(Path)-1); | |
| 602 | - if (System.Copy(Path, 0, 12) = 'Root Folder/') then | |
| 603 | - Path := System.Copy(Path, 12, Length(Path)-1); | |
| 604 | - | |
| 605 | - DocumentDetail := FKTAPI.SoapClient.get_document_detail_by_name(FKTAPI.Session, | |
| 606 | - Path, 'F'); | |
| 607 | - try | |
| 608 | - if (DocumentDetail.status_code <> 0) then | |
| 609 | - raise EKTWSAPI_Exception.Create(DocumentDetail.message_); | |
| 610 | - Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail); | |
| 611 | - finally | |
| 612 | - DocumentDetail.Free; | |
| 613 | - end; | |
| 614 | -end; | |
| 615 | - | |
| 616 | -{* | |
| 617 | - Adds a sub folder. | |
| 618 | - | |
| 619 | - @param FolderName Name of folder | |
| 620 | - @return new folder handle | |
| 621 | - @throws EKTWSAPI_Exception Response message | |
| 622 | -*} | |
| 623 | -function TKTWSAPI_Folder.AddFolder(FolderName: WideString): TKTWSAPI_Folder; | |
| 624 | -var | |
| 625 | - FolderDetail: kt_folder_detail; | |
| 626 | -begin | |
| 627 | - Result := nil; | |
| 628 | - FolderDetail := FKTAPI.SoapClient.create_folder(FKTAPI.Session, FFolderId, FolderName); | |
| 629 | - try | |
| 630 | - if (FolderDetail.status_code <> 0) then | |
| 631 | - raise EKTWSAPI_Exception.Create(FolderDetail.message_); | |
| 632 | - | |
| 633 | - Result := TKTWSAPI_Folder.Create(FKTAPI, FolderDetail); | |
| 634 | - finally | |
| 635 | - FolderDetail.Free; | |
| 636 | - end; | |
| 637 | -end; | |
| 638 | - | |
| 639 | -{* | |
| 640 | - Deletes the current folder. | |
| 641 | - | |
| 642 | - @param Reason Reason for deletetion | |
| 643 | - @return true | |
| 644 | - @throws EKTWSAPI_Exception Response message | |
| 645 | -*} | |
| 646 | -function TKTWSAPI_Folder.Delete(Reason: WideString): Boolean; | |
| 647 | -var | |
| 648 | - response: kt_response; | |
| 649 | -begin | |
| 650 | - // TODO: check why no transaction in folder_transactions | |
| 651 | - Result := System.False; | |
| 652 | - response := FKTAPI.SoapClient.delete_folder(FKTAPI.Session, | |
| 653 | - FFolderId, Reason); | |
| 654 | - try | |
| 655 | - if (response.status_code <> 0) then | |
| 656 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 657 | - Result := System.True; | |
| 658 | - finally | |
| 659 | - response.Free; | |
| 660 | - end; | |
| 661 | -end; | |
| 662 | - | |
| 663 | -{* | |
| 664 | - Renames the current folder. | |
| 665 | - | |
| 666 | - @param NewName New folder name | |
| 667 | - @return true | |
| 668 | - @throws EKTWSAPI_Exception Response message | |
| 669 | -*} | |
| 670 | -function TKTWSAPI_Folder.Rename(NewName: WideString): Boolean; | |
| 671 | -var | |
| 672 | - response: kt_response; | |
| 673 | -begin | |
| 674 | - Result := System.False; | |
| 675 | - response := FKTAPI.SoapClient.rename_folder(FKTAPI.Session, | |
| 676 | - FFolderId, NewName); | |
| 677 | - try | |
| 678 | - if (response.status_code <> 0) then | |
| 679 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 680 | - Result := System.True; | |
| 681 | - finally | |
| 682 | - response.Free; | |
| 683 | - end; | |
| 684 | -end; | |
| 685 | - | |
| 686 | -{* | |
| 687 | - Moves a folder to another location. | |
| 688 | - | |
| 689 | - @param TargetFolder Handle to target folder | |
| 690 | - @param Reason Reason for move | |
| 691 | - @return true | |
| 692 | - @throws EKTWSAPI_Exception Response message | |
| 693 | -*} | |
| 694 | -function TKTWSAPI_Folder.Move(TargetFolder: TKTWSAPI_Folder; | |
| 695 | - Reason: WideString): Boolean; | |
| 696 | -var | |
| 697 | - response: kt_response; | |
| 698 | -begin | |
| 699 | - Result := System.False; | |
| 700 | - Assert(Assigned(TargetFolder)); | |
| 701 | - Assert(TargetFolder.ClassNameIs('TKTWSAPI_Folder')); | |
| 702 | - | |
| 703 | - response := FKTAPI.SoapClient.move_folder(FKTAPI.Session, | |
| 704 | - FFolderId, TargetFolder.GetFolderId, Reason); | |
| 705 | - try | |
| 706 | - if (response.status_code <> 0) then | |
| 707 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 708 | - Result := System.True; | |
| 709 | - finally | |
| 710 | - response.Free; | |
| 711 | - end; | |
| 712 | -end; | |
| 713 | - | |
| 714 | -{* | |
| 715 | - Copies a folder to another location | |
| 716 | - | |
| 717 | - @param TargetFolder Handle to target folder | |
| 718 | - @param Reason Reason for copy | |
| 719 | - @return true | |
| 720 | - @throws EKTWSAPI_Exception Response message | |
| 721 | -*} | |
| 722 | -function TKTWSAPI_Folder.Copy(TargetFolder: TKTWSAPI_Folder; | |
| 723 | - Reason: WideString): Boolean; | |
| 724 | -var | |
| 725 | - TargetId: Integer; | |
| 726 | - response: kt_response; | |
| 727 | -begin | |
| 728 | - Result := System.False; | |
| 729 | - Assert(Assigned(TargetFolder)); | |
| 730 | - Assert(TargetFolder.ClassNameIs('TKTWSAPI_Folder')); | |
| 731 | - | |
| 732 | - TargetId := TargetFolder.GetFolderId; | |
| 733 | - response := FKTAPI.SoapClient.copy_folder(FKTAPI.Session, | |
| 734 | - FFolderId, TargetId, Reason); | |
| 735 | - try | |
| 736 | - if (response.status_code <> 0) then | |
| 737 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 738 | - Result := System.True; | |
| 739 | - finally | |
| 740 | - response.Free; | |
| 741 | - end; | |
| 742 | -end; | |
| 743 | - | |
| 744 | -{* | |
| 745 | - Adds a document to the current folder. | |
| 746 | - | |
| 747 | - @param FileName FileName to upload | |
| 748 | - @param Title Title to give document | |
| 749 | - @param DocumentType Documenttype of document (Default is 'Default') | |
| 750 | - @return handle to new document | |
| 751 | - @throws EKTWSAPI_Exception Response message | |
| 752 | -*} | |
| 753 | -function TKTWSAPI_Folder.AddDocument(FileName, Title, | |
| 754 | - DocumentType: WideString): TKTWSAPI_Document; | |
| 755 | -var | |
| 756 | - BaseName, TempFileName: WideString; | |
| 757 | - DocumentDetail: kt_document_detail; | |
| 758 | -begin | |
| 759 | - Result := nil; | |
| 760 | - BaseName := ExtractFileName(FileName); | |
| 761 | - if (Title = '') then | |
| 762 | - Title := BaseName; | |
| 763 | - if (DocumentType = '') then | |
| 764 | - DocumentType := 'Default'; | |
| 765 | - | |
| 766 | - TempFileName := _UploadFile(FileName, 'A'); | |
| 767 | - DocumentDetail := FKTAPI.FSoapClient.add_document(FKTAPI.Session, FFolderId, | |
| 768 | - Title, BaseName, DocumentType, TempFileName); | |
| 769 | - try | |
| 770 | - if (DocumentDetail.status_code <> 0) then | |
| 771 | - raise EKTWSAPI_Exception.Create(DocumentDetail.message_); | |
| 772 | - | |
| 773 | - Result := TKTWSAPI_Document.Create(FKTAPI, DocumentDetail); | |
| 774 | - finally | |
| 775 | - DocumentDetail.Free; | |
| 776 | - end; | |
| 777 | -end; | |
| 778 | - | |
| 779 | -{* | |
| 780 | - Adds a document to the current folder through web service. | |
| 781 | - | |
| 782 | - @param FileName FileName to upload | |
| 783 | - @param Title Title to give document | |
| 784 | - @param DocumentType Documenttype of document (Default is 'Default') | |
| 785 | - @return handle to new document | |
| 786 | - @throws EKTWSAPI_Exception Response message | |
| 787 | -*} | |
| 788 | -function TKTWSAPI_Folder.AddDocumentBase64(FileName, Title, | |
| 789 | - DocumentType: WideString): TKTWSAPI_Document; | |
| 790 | -begin | |
| 791 | - raise EKTWSAPI_Exception.Create('Not implemented yet!'); | |
| 792 | -end; | |
| 793 | - | |
| 794 | -{ TKTWSAPI_Document } | |
| 795 | - | |
| 796 | -{* | |
| 797 | - Constructor | |
| 798 | - | |
| 799 | - @param KTAPI Handle to KTAPI object | |
| 800 | - @param DocumentDetail handle to kt_document_detail | |
| 801 | -*} | |
| 802 | -constructor TKTWSAPI_Document.Create(KTAPI: TKTWSAPI; | |
| 803 | - DocumentDetail: kt_document_detail); | |
| 804 | -begin | |
| 805 | - FKTAPI := KTAPI; | |
| 806 | - FDocumentId := DocumentDetail.document_id; | |
| 807 | - FTitle := DocumentDetail.title; | |
| 808 | - FDocumentType := DocumentDetail.document_type; | |
| 809 | - FVersion := DocumentDetail.version; | |
| 810 | - FFilename := DocumentDetail.filename; | |
| 811 | - FCreatedDate := DocumentDetail.created_date; | |
| 812 | - FCreatedBy := DocumentDetail.created_by; | |
| 813 | - FUpdatedDate := DocumentDetail.updated_date; | |
| 814 | - FUpdatedBy := DocumentDetail.updated_by; | |
| 815 | - FParentId := DocumentDetail.folder_id; | |
| 816 | - FWorkflow := DocumentDetail.workflow; | |
| 817 | - FWorkflowState := DocumentDetail.workflow_state; | |
| 818 | - FCheckoutBy := DocumentDetail.checkout_by; | |
| 819 | - FFullPath := DocumentDetail.full_path; | |
| 820 | -end; | |
| 821 | - | |
| 822 | -{* | |
| 823 | - Returns a reference to a document. | |
| 824 | - | |
| 825 | - @param KTAPI Handle to KTAPI object | |
| 826 | - @param DocumentId Id of document | |
| 827 | - @param LoadInfo Call web service to load document details | |
| 828 | - @return handle to document | |
| 829 | - @throws EKTWSAPI_Exception Response message | |
| 830 | -*} | |
| 831 | -class function TKTWSAPI_Document.Get(KTAPI: TKTWSAPI; DocumentId: Integer; | |
| 832 | - LoadInfo: Boolean): TKTWSAPI_Document; | |
| 833 | -var | |
| 834 | - DocumentDetail:kt_document_detail; | |
| 835 | -begin | |
| 836 | - Assert(Assigned(KTAPI)); | |
| 837 | - Assert(KTAPI.ClassNameIs('TKTWSAPI')); | |
| 838 | - if LoadInfo then | |
| 839 | - begin | |
| 840 | - DocumentDetail := KTAPI.SoapClient.get_document_detail(KTAPI.Session, DocumentId); | |
| 841 | - | |
| 842 | - if (DocumentDetail.status_code <> 0) then | |
| 843 | - raise EKTWSAPI_Exception.Create(DocumentDetail.message_); | |
| 844 | - | |
| 845 | - end else | |
| 846 | - begin | |
| 847 | - DocumentDetail := kt_document_detail.Create; | |
| 848 | - DocumentDetail.document_id := DocumentId; | |
| 849 | - end; | |
| 850 | - try | |
| 851 | - Result := TKTWSAPI_Document.Create(KTAPI, DocumentDetail); | |
| 852 | - finally | |
| 853 | - DocumentDetail.Free; | |
| 854 | - end; | |
| 855 | -end; | |
| 856 | - | |
| 857 | -{* | |
| 858 | - Checks in a document. | |
| 859 | - | |
| 860 | - @param FileName Name of file to checkin | |
| 861 | - @param Reason Reason for checkin | |
| 862 | - @param MajorUpdate Checkin as a major update (bumps major version number) | |
| 863 | - @return true | |
| 864 | - @throws EKTWSAPI_Exception Response message | |
| 865 | -*} | |
| 866 | -function TKTWSAPI_Document.Checkin(FileName, Reason: WideString; | |
| 867 | - MajorUpdate: Boolean): Boolean; | |
| 868 | -var | |
| 869 | - BaseName, TempFileName: WideString; | |
| 870 | - response: kt_response; | |
| 871 | -begin | |
| 872 | - Result := System.False; | |
| 873 | - BaseName := ExtractFileName(FileName); | |
| 874 | - | |
| 875 | - TempFileName := _UploadFile(FileName, 'C', FDocumentId); | |
| 876 | - response := FKTAPI.SoapClient.checkin_document(FKTAPI.Session, FDocumentId, BaseName, Reason, TempFileName, MajorUpdate); | |
| 877 | - try | |
| 878 | - if (response.status_code <> 0) then | |
| 879 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 880 | - Result := System.True; | |
| 881 | - finally | |
| 882 | - response.Free; | |
| 883 | - end; | |
| 884 | -end; | |
| 885 | - | |
| 886 | -{* | |
| 887 | - Checks out a document. | |
| 888 | - | |
| 889 | - @param Reason Reason for checkout | |
| 890 | - @param LocalPath to save downloaded file to | |
| 891 | - @param DownloadFile if false then checkout will happen without download | |
| 892 | - @return true | |
| 893 | - @throws EKTWSAPI_Exception local path does not exist | |
| 894 | - @throws EKTWSAPI_Exception Response message | |
| 895 | -*} | |
| 896 | -function TKTWSAPI_Document.Checkout(Reason, LocalPath: WideString; | |
| 897 | - DownloadFile: Boolean): Boolean; | |
| 898 | -var | |
| 899 | - response: kt_response; | |
| 900 | - Url: WideString; | |
| 901 | -begin | |
| 902 | - Result := System.False; | |
| 903 | - if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath; | |
| 904 | - | |
| 905 | - if not DirectoryExists(LocalPath) then | |
| 906 | - raise EKTWSAPI_Exception.Create('local path does not exist'); | |
| 907 | - | |
| 908 | - // TODO check if Directory is writable | |
| 909 | - | |
| 910 | - response := FKTAPI.SoapClient.checkout_document(FKTAPI.Session, FDocumentId, Reason); | |
| 911 | - try | |
| 912 | - if (response.status_code <> 0) then | |
| 913 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 914 | - | |
| 915 | - Url := response.message_; | |
| 916 | - | |
| 917 | - if DownloadFile then | |
| 918 | - _DownloadFile(KTWebServerURL+Url, LocalPath, FFileName); | |
| 919 | - | |
| 920 | - Result := System.True; | |
| 921 | - finally | |
| 922 | - response.Free; | |
| 923 | - end; | |
| 924 | -end; | |
| 925 | - | |
| 926 | -{* | |
| 927 | - Undo a document checkout | |
| 928 | - | |
| 929 | - @param Reason Reason for undoing the checkout | |
| 930 | - @return true | |
| 931 | - @throws EKTWSAPI_Exception Response message | |
| 932 | -*} | |
| 933 | -function TKTWSAPI_Document.UndoCheckout(Reason: WideString): Boolean; | |
| 934 | -var | |
| 935 | - response: kt_response; | |
| 936 | -begin | |
| 937 | - Result := System.False; | |
| 938 | - response := FKTAPI.SoapClient.undo_document_checkout(FKTAPI.Session, FDocumentId, Reason); | |
| 939 | - try | |
| 940 | - if (response.status_code <> 0) then | |
| 941 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 942 | - | |
| 943 | - Result := System.True; | |
| 944 | - finally | |
| 945 | - response.Free; | |
| 946 | - end; | |
| 947 | -end; | |
| 948 | - | |
| 949 | -{* | |
| 950 | - Download a version of the document | |
| 951 | - | |
| 952 | - @param Version Which version of document to download | |
| 953 | - @param LocalPath Optional path to save file to | |
| 954 | - @param FileName Optional filename to save file as | |
| 955 | - @return true | |
| 956 | - @throws EKTWSAPI_Exception local path does not exist | |
| 957 | - @throws EKTWSAPI_Exception Response message | |
| 958 | -*} | |
| 959 | -function TKTWSAPI_Document.Download(Version, LocalPath, FileName: WideString): Boolean; | |
| 960 | -var | |
| 961 | - response: kt_response; | |
| 962 | - Url: WideString; | |
| 963 | -begin | |
| 964 | - Result := System.False; | |
| 965 | - if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath; | |
| 966 | - if (FileName = '') then FileName := FFileName; | |
| 967 | - | |
| 968 | - if (not DirectoryExists(LocalPath)) then | |
| 969 | - raise EKTWSAPI_Exception.Create('local path does not exist'); | |
| 970 | - | |
| 971 | - // TODO: Check if local path is writable | |
| 972 | - | |
| 973 | - response := FKTAPI.SoapClient.download_document(FKTAPI.Session, FDocumentId); | |
| 974 | - try | |
| 975 | - if (response.status_code <> 0) then | |
| 976 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 977 | - Url := response.message_; | |
| 978 | - Result := _DownloadFile(KTWebServerURL+Url, LocalPath, FileName); | |
| 979 | - finally | |
| 980 | - response.Free; | |
| 981 | - end; | |
| 982 | -end; | |
| 983 | - | |
| 984 | - | |
| 985 | -{* | |
| 986 | - Download a version of the document through webservice | |
| 987 | - | |
| 988 | - @param Version Which version of document to download | |
| 989 | - @param LocalPath Path to save file to | |
| 990 | - @return true | |
| 991 | - @throws EKTWSAPI_Exception Response message | |
| 992 | -*} | |
| 993 | -function TKTWSAPI_Document.DownloadBase64(Version, | |
| 994 | - LocalPath: WideString): Boolean; | |
| 995 | -var | |
| 996 | - response: kt_response; | |
| 997 | -begin | |
| 998 | - Result := System.False; | |
| 999 | - if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath; | |
| 1000 | - if (FileName = '') then FileName := FFileName; | |
| 1001 | - | |
| 1002 | - if (not DirectoryExists(LocalPath)) then | |
| 1003 | - raise EKTWSAPI_Exception.Create('local path does not exist'); | |
| 1004 | - | |
| 1005 | - // TODO: Check if local path is writable | |
| 1006 | - | |
| 1007 | - response := FKTAPI.SoapClient.download_base64_document(FKTAPI.Session, FDocumentId); | |
| 1008 | - try | |
| 1009 | - if (response.status_code <> 0) then | |
| 1010 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1011 | - Result := _SaveBase64StringAsFile(response.message_, LocalPath, FileName); | |
| 1012 | - finally | |
| 1013 | - response.Free; | |
| 1014 | - end; | |
| 1015 | -end; | |
| 1016 | - | |
| 1017 | -{* | |
| 1018 | - Deletes the current document. | |
| 1019 | - | |
| 1020 | - @param Reason Reason for delete | |
| 1021 | - @return true | |
| 1022 | - @throws EKTWSAPI_Exception Response message | |
| 1023 | -*} | |
| 1024 | -function TKTWSAPI_Document.Delete(Reason: WideString): Boolean; | |
| 1025 | -var | |
| 1026 | - response: kt_response; | |
| 1027 | -begin | |
| 1028 | - Result := System.False; | |
| 1029 | - response := FKTAPI.SoapClient.delete_document(FKTAPI.Session, FDocumentId, Reason); | |
| 1030 | - try | |
| 1031 | - if (response.status_code <> 0) then | |
| 1032 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1033 | - | |
| 1034 | - Result := System.True; | |
| 1035 | - finally | |
| 1036 | - response.Free; | |
| 1037 | - end; | |
| 1038 | -end; | |
| 1039 | - | |
| 1040 | -{* | |
| 1041 | - Changes the owner of the document. | |
| 1042 | - | |
| 1043 | - @param UserName Username of new owner | |
| 1044 | - @param Reason Reason for the owner change | |
| 1045 | - @return true | |
| 1046 | - @throws EKTWSAPI_Exception Response message | |
| 1047 | -*} | |
| 1048 | -function TKTWSAPI_Document.ChangeOwner(UserName, Reason: WideString): Boolean; | |
| 1049 | -var | |
| 1050 | - response: kt_response; | |
| 1051 | -begin | |
| 1052 | - Result := System.False; | |
| 1053 | - response := FKTAPI.SoapClient.change_document_owner(FKTAPI.Session, FDocumentId, UserName, Reason); | |
| 1054 | - try | |
| 1055 | - if (response.status_code <> 0) then | |
| 1056 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1057 | - | |
| 1058 | - Result := System.True; | |
| 1059 | - finally | |
| 1060 | - response.Free; | |
| 1061 | - end; | |
| 1062 | -end; | |
| 1063 | - | |
| 1064 | -{* | |
| 1065 | - Copies the current document to the specified folder. | |
| 1066 | - | |
| 1067 | - @param Folder Handle to target folder | |
| 1068 | - @param Reason Reason for copy | |
| 1069 | - @param NewTitle New title of the file | |
| 1070 | - @param NewFileName New filename of the file | |
| 1071 | - @return true | |
| 1072 | - @throws EKTWSAPI_Exception Response message | |
| 1073 | -*} | |
| 1074 | -function TKTWSAPI_Document.Copy(Folder: TKTWSAPI_Folder; Reason, NewTitle, | |
| 1075 | - NewFileName: WideString): Boolean; | |
| 1076 | -var | |
| 1077 | - response: kt_response; | |
| 1078 | - FolderId: Integer; | |
| 1079 | -begin | |
| 1080 | - Result := System.False; | |
| 1081 | - Assert(Assigned(Folder)); | |
| 1082 | - Assert(Folder.ClassNameIs('TKTWSAPI_Folder')); | |
| 1083 | - FolderId := Folder.GetFolderId; | |
| 1084 | - | |
| 1085 | - response := FKTAPI.SoapClient.copy_document(FKTAPI.Session, FDocumentId, FolderId, Reason, NewTitle, NewFileName); | |
| 1086 | - try | |
| 1087 | - if (response.status_code <> 0) then | |
| 1088 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1089 | - | |
| 1090 | - Result := System.True; | |
| 1091 | - finally | |
| 1092 | - response.Free; | |
| 1093 | - end; | |
| 1094 | -end; | |
| 1095 | - | |
| 1096 | -{* | |
| 1097 | - Moves the current document to the specified folder. | |
| 1098 | - | |
| 1099 | - @param Folder Handle to target folder | |
| 1100 | - @param Reason Reason for move | |
| 1101 | - @param NewTitle New title of the file | |
| 1102 | - @param NewFileName New filename of the file | |
| 1103 | - @return true | |
| 1104 | - @throws EKTWSAPI_Exception Response message | |
| 1105 | -*} | |
| 1106 | -function TKTWSAPI_Document.Move(Folder: TKTWSAPI_Folder; Reason, NewTitle, | |
| 1107 | - NewFileName: WideString): Boolean; | |
| 1108 | -var | |
| 1109 | - response: kt_response; | |
| 1110 | - FolderId: Integer; | |
| 1111 | -begin | |
| 1112 | - Result := System.False; | |
| 1113 | - Assert(Assigned(Folder)); | |
| 1114 | - Assert(Folder.ClassNameIs('TKTWSAPI_Folder')); | |
| 1115 | - FolderId := Folder.GetFolderId; | |
| 1116 | - | |
| 1117 | - response := FKTAPI.SoapClient.move_document(FKTAPI.Session, FDocumentId, FolderId, Reason, NewTitle, NewFileName); | |
| 1118 | - try | |
| 1119 | - if (response.status_code <> 0) then | |
| 1120 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1121 | - Result := System.True; | |
| 1122 | - finally | |
| 1123 | - response.Free; | |
| 1124 | - end; | |
| 1125 | -end; | |
| 1126 | - | |
| 1127 | -{* | |
| 1128 | - Changes the document type. | |
| 1129 | - | |
| 1130 | - @param DocumentType DocumentType to change to | |
| 1131 | - @return true | |
| 1132 | - @throws EKTWSAPI_Exception Response message | |
| 1133 | -*} | |
| 1134 | -function TKTWSAPI_Document.ChangeDocumentType(DocumentType: WideString): Boolean; | |
| 1135 | -var | |
| 1136 | - response: kt_response; | |
| 1137 | -begin | |
| 1138 | - Result := System.False; | |
| 1139 | - response := FKTAPI.SoapClient.change_document_type(FKTAPI.Session, FDocumentId, DocumentType); | |
| 1140 | - try | |
| 1141 | - if (response.status_code <> 0) then | |
| 1142 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1143 | - | |
| 1144 | - Result := System.True; | |
| 1145 | - finally | |
| 1146 | - response.Free; | |
| 1147 | - end; | |
| 1148 | -end; | |
| 1149 | - | |
| 1150 | -{* | |
| 1151 | - Renames the title of the current document. | |
| 1152 | - | |
| 1153 | - @param NewTitle New title of the document | |
| 1154 | - @return true | |
| 1155 | - @throws EKTWSAPI_Exception Response message | |
| 1156 | -*} | |
| 1157 | -function TKTWSAPI_Document.RenameTitle(NewTitle: WideString): Boolean; | |
| 1158 | -var | |
| 1159 | - response: kt_response; | |
| 1160 | -begin | |
| 1161 | - Result := System.False; | |
| 1162 | - response := FKTAPI.SoapClient.rename_document_title(FKTAPI.Session, FDocumentId, NewTitle); | |
| 1163 | - try | |
| 1164 | - if (response.status_code <> 0) then | |
| 1165 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1166 | - | |
| 1167 | - Result := System.True; | |
| 1168 | - finally | |
| 1169 | - response.Free; | |
| 1170 | - end; | |
| 1171 | -end; | |
| 1172 | - | |
| 1173 | -{* | |
| 1174 | - Renames the filename of the current document. | |
| 1175 | - | |
| 1176 | - @param NewFilename New filename of the document | |
| 1177 | - @return true | |
| 1178 | -*} | |
| 1179 | -function TKTWSAPI_Document.RenameFilename(NewFilename: WideString): Boolean; | |
| 1180 | -var | |
| 1181 | - response: kt_response; | |
| 1182 | -begin | |
| 1183 | - Result := System.False; | |
| 1184 | - response := FKTAPI.SoapClient.rename_document_filename(FKTAPI.Session, FDocumentId, NewFilename); | |
| 1185 | - try | |
| 1186 | - if (response.status_code <> 0) then | |
| 1187 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1188 | - | |
| 1189 | - Result := System.True; | |
| 1190 | - finally | |
| 1191 | - response.Free; | |
| 1192 | - end; | |
| 1193 | -end; | |
| 1194 | - | |
| 1195 | -{* | |
| 1196 | - Starts a workflow on the current document. | |
| 1197 | - | |
| 1198 | - @param WorkFlow Workflow | |
| 1199 | - @return true | |
| 1200 | - @throws EKTWSAPI_Exception Response message | |
| 1201 | -*} | |
| 1202 | -function TKTWSAPI_Document.StartWorkflow(WorkFlow: WideString): Boolean; | |
| 1203 | -var | |
| 1204 | - response: kt_response; | |
| 1205 | -begin | |
| 1206 | - Result := System.False; | |
| 1207 | - response := FKTAPI.SoapClient.start_document_workflow(FKTAPI.Session, FDocumentId, WorkFlow); | |
| 1208 | - try | |
| 1209 | - if (response.status_code <> 0) then | |
| 1210 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1211 | - | |
| 1212 | - Result := System.True; | |
| 1213 | - finally | |
| 1214 | - response.Free; | |
| 1215 | - end; | |
| 1216 | -end; | |
| 1217 | - | |
| 1218 | -{* | |
| 1219 | - Removes the workflow process from the current document. | |
| 1220 | - | |
| 1221 | - @return true | |
| 1222 | - @throws EKTWSAPI_Exception Response message | |
| 1223 | -*} | |
| 1224 | -function TKTWSAPI_Document.DeleteWorkflow: Boolean; | |
| 1225 | -var | |
| 1226 | - response: kt_response; | |
| 1227 | -begin | |
| 1228 | - Result := System.False; | |
| 1229 | - response := FKTAPI.SoapClient.delete_document_workflow(FKTAPI.Session, FDocumentId); | |
| 1230 | - try | |
| 1231 | - if (response.status_code <> 0) then | |
| 1232 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1233 | - | |
| 1234 | - Result := System.True; | |
| 1235 | - finally | |
| 1236 | - response.Free; | |
| 1237 | - end; | |
| 1238 | -end; | |
| 1239 | - | |
| 1240 | -{* | |
| 1241 | - Performs a transition on the current document. | |
| 1242 | - | |
| 1243 | - @param Transition Transition | |
| 1244 | - @param Reason Reason for transition | |
| 1245 | - @return true | |
| 1246 | - @throws EKTWSAPI_Exception Response message | |
| 1247 | -*} | |
| 1248 | -function TKTWSAPI_Document.PeformWorkflowTransition(Transition, | |
| 1249 | - Reason: WideString): Boolean; | |
| 1250 | -var | |
| 1251 | - response: kt_response; | |
| 1252 | -begin | |
| 1253 | - Result := System.False; | |
| 1254 | - response := FKTAPI.SoapClient.perform_document_workflow_transition(FKTAPI.Session, FDocumentId, Transition, Reason); | |
| 1255 | - try | |
| 1256 | - if (response.status_code <> 0) then | |
| 1257 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1258 | - | |
| 1259 | - Result := System.True; | |
| 1260 | - finally | |
| 1261 | - response.Free; | |
| 1262 | - end; | |
| 1263 | -end; | |
| 1264 | - | |
| 1265 | -{* | |
| 1266 | - Returns metadata on the document. | |
| 1267 | - | |
| 1268 | - @return handle to metadata | |
| 1269 | - @throws EKTWSAPI_Exception Response message | |
| 1270 | -*} | |
| 1271 | -function TKTWSAPI_Document.GetMetadata: kt_metadata_response; | |
| 1272 | -begin | |
| 1273 | - Result := FKTAPI.SoapClient.get_document_metadata(FKTAPI.Session, FDocumentId); | |
| 1274 | - | |
| 1275 | - if (Result.status_code <> 0) then | |
| 1276 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1277 | -end; | |
| 1278 | - | |
| 1279 | -{* | |
| 1280 | - Updates the metadata on the current document. | |
| 1281 | - | |
| 1282 | - @param Metadata Handle to metadata | |
| 1283 | - @return true | |
| 1284 | - @throws EKTWSAPI_Exception Response message | |
| 1285 | -*} | |
| 1286 | -function TKTWSAPI_Document.UpdateMetadata( | |
| 1287 | - Metadata: kt_metadata_fieldsets): Boolean; | |
| 1288 | -var | |
| 1289 | - response: kt_response; | |
| 1290 | -begin | |
| 1291 | - Result := System.False; | |
| 1292 | - response := FKTAPI.SoapClient.update_document_metadata(FKTAPI.Session, FDocumentId, MetaData); | |
| 1293 | - try | |
| 1294 | - if (response.status_code <> 0) then | |
| 1295 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1296 | - | |
| 1297 | - Result := System.True; | |
| 1298 | - finally | |
| 1299 | - response.Free; | |
| 1300 | - end; | |
| 1301 | -end; | |
| 1302 | - | |
| 1303 | -{* | |
| 1304 | - Returns the transaction history on the current document. | |
| 1305 | - | |
| 1306 | - @return handle to transaction history | |
| 1307 | - @throws EKTWSAPI_Exception Response message | |
| 1308 | -*} | |
| 1309 | -function TKTWSAPI_Document.GetTransactionHistory: kt_document_transaction_history_response; | |
| 1310 | -begin | |
| 1311 | - Result := FKTAPI.SoapClient.get_document_transaction_history(FKTAPI.Session, FDocumentId); | |
| 1312 | - if (Result.status_code <> 0) then | |
| 1313 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1314 | -end; | |
| 1315 | - | |
| 1316 | -{* | |
| 1317 | - Returns the version history on the current document. | |
| 1318 | - | |
| 1319 | - @return handle to document version history | |
| 1320 | - @throws EKTWSAPI_Exception Response message | |
| 1321 | -*} | |
| 1322 | -function TKTWSAPI_Document.GetVersionHistory: kt_document_version_history_response; | |
| 1323 | -begin | |
| 1324 | - Result := FKTAPI.SoapClient.get_document_version_history(FKTAPI.Session, FDocumentId); | |
| 1325 | - if (Result.status_code <> 0) then | |
| 1326 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1327 | -end; | |
| 1328 | - | |
| 1329 | -{* | |
| 1330 | - Returns the links of the current document | |
| 1331 | - | |
| 1332 | - @return handle to document version history | |
| 1333 | - @throws EKTWSAPI_Exception Response message | |
| 1334 | -*} | |
| 1335 | -function TKTWSAPI_Document.GetLinks: kt_linked_document_response; | |
| 1336 | -begin | |
| 1337 | - Result := FKTAPI.SoapClient.get_document_links(FKTAPI.Session, FDocumentId); | |
| 1338 | - if (Result.status_code <> 0) then | |
| 1339 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1340 | -end; | |
| 1341 | - | |
| 1342 | -{* | |
| 1343 | - Links the current document to a DocumentId | |
| 1344 | - | |
| 1345 | - @param DocumentId DocumentId to link to | |
| 1346 | - @param LinkType Type of link | |
| 1347 | - @return true | |
| 1348 | - @throws EKTWSAPI_Exception Response message | |
| 1349 | -*} | |
| 1350 | -function TKTWSAPI_Document.Link(DocumentId: Integer; | |
| 1351 | - const LinkType: WideString): Boolean; | |
| 1352 | -var | |
| 1353 | - response: kt_response; | |
| 1354 | -begin | |
| 1355 | - Result := System.False; | |
| 1356 | - response := FKTAPI.SoapClient.link_documents(FKTAPI.Session, FDocumentId, | |
| 1357 | - DocumentId, LinkType); | |
| 1358 | - try | |
| 1359 | - if (response.status_code <> 0) then | |
| 1360 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1361 | - Result := System.True; | |
| 1362 | - finally | |
| 1363 | - response.Free; | |
| 1364 | - end; | |
| 1365 | -end; | |
| 1366 | - | |
| 1367 | -{* | |
| 1368 | - Unlinks the current document from a DocumentId | |
| 1369 | - | |
| 1370 | - @param DocumentId DocumentId to unlink to | |
| 1371 | - @return true | |
| 1372 | - @throws EKTWSAPI_Exception Response message | |
| 1373 | -*} | |
| 1374 | -function TKTWSAPI_Document.Unlink(DocumentId: Integer): Boolean; | |
| 1375 | -var | |
| 1376 | - response: kt_response; | |
| 1377 | -begin | |
| 1378 | - Result := System.False; | |
| 1379 | - response := FKTAPI.SoapClient.unlink_documents(FKTAPI.Session, FDocumentId, | |
| 1380 | - DocumentId); | |
| 1381 | - try | |
| 1382 | - if (response.status_code <> 0) then | |
| 1383 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1384 | - Result := System.True; | |
| 1385 | - finally | |
| 1386 | - response.Free; | |
| 1387 | - end; | |
| 1388 | -end; | |
| 1389 | - | |
| 1390 | -{* | |
| 1391 | - Checks out a document and downloads document through webservice | |
| 1392 | - | |
| 1393 | - @param Reason Reason for checkout | |
| 1394 | - @param LocalPath to save downloaded file to | |
| 1395 | - @return true | |
| 1396 | - @throws EKTWSAPI_Exception local path does not exist | |
| 1397 | - @throws EKTWSAPI_Exception Response message | |
| 1398 | -*} | |
| 1399 | -function TKTWSAPI_Document.CheckoutBase64(Reason, | |
| 1400 | - LocalPath: WideString; DownloadFile: Boolean): Boolean; | |
| 1401 | -var | |
| 1402 | - response: kt_response; | |
| 1403 | -begin | |
| 1404 | - Result := System.False; | |
| 1405 | - if (LocalPath = '') then LocalPath := FKTAPI.GetDownloadPath; | |
| 1406 | - | |
| 1407 | - if not DirectoryExists(LocalPath) then | |
| 1408 | - raise EKTWSAPI_Exception.Create('local path does not exist'); | |
| 1409 | - | |
| 1410 | - // TODO check if Directory is writable | |
| 1411 | - | |
| 1412 | - response := FKTAPI.SoapClient.checkout_base64_document(FKTAPI.Session, FDocumentId, Reason, DownloadFile); | |
| 1413 | - try | |
| 1414 | - if (response.status_code <> 0) then | |
| 1415 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1416 | - Result := True; | |
| 1417 | - if DownloadFile then | |
| 1418 | - Result := _SaveBase64StringAsFile(response.message_, LocalPath, FFileName); | |
| 1419 | - finally | |
| 1420 | - response.Free; | |
| 1421 | - end; | |
| 1422 | -end; | |
| 1423 | - | |
| 1424 | -{* | |
| 1425 | - Gets list of document types | |
| 1426 | - | |
| 1427 | - @return handle to document types response | |
| 1428 | - @throws EKTWSAPI_Exception Response message | |
| 1429 | -*} | |
| 1430 | -function TKTWSAPI_Document.GetTypes: kt_document_types_response; | |
| 1431 | -begin | |
| 1432 | - Result := FKTAPI.SoapClient.get_document_types(FKTAPI.Session); | |
| 1433 | - if (Result.status_code <> 0) then | |
| 1434 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1435 | -end; | |
| 1436 | - | |
| 1437 | -{* | |
| 1438 | - Get list of document link types | |
| 1439 | - @return handle to document types response | |
| 1440 | - @throws EKTWSAPI_Exception Response message | |
| 1441 | -*} | |
| 1442 | -function TKTWSAPI_Document.GetLinkTypes: kt_document_types_response; | |
| 1443 | -begin | |
| 1444 | - Result := FKTAPI.SoapClient.get_document_link_types(FKTAPI.Session); | |
| 1445 | - if (Result.status_code <> 0) then | |
| 1446 | - raise EKTWSAPI_Exception.Create(Result.message_); | |
| 1447 | -end; | |
| 1448 | - | |
| 1449 | -{* | |
| 1450 | - Checks in a document and uploads through webservice | |
| 1451 | - | |
| 1452 | - @param FileName Name of file to checkin | |
| 1453 | - @param Reason Reason for checkin | |
| 1454 | - @param MajorUpdate Checkin as a major update (bumps major version number) | |
| 1455 | - @return true | |
| 1456 | - @throws EKTWSAPI_Exception Response message | |
| 1457 | -*} | |
| 1458 | -function TKTWSAPI_Document.CheckinBase64(FileName, Reason: WideString; | |
| 1459 | - MajorUpdate: Boolean): Boolean; | |
| 1460 | -var | |
| 1461 | - Base64String, BaseName: WideString; | |
| 1462 | - response: kt_response; | |
| 1463 | -begin | |
| 1464 | - Result := System.False; | |
| 1465 | - Base64String := _LoadFileAsBase64String(FileName); | |
| 1466 | - BaseName := ExtractFileName(FileName); | |
| 1467 | - | |
| 1468 | - response := FKTAPI.SoapClient.checkin_base64_document(FKTAPI.Session, | |
| 1469 | - FDocumentId, BaseName, Reason, Base64String, MajorUpdate); | |
| 1470 | - try | |
| 1471 | - if (response.status_code <> 0) then | |
| 1472 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1473 | - Result := System.True; | |
| 1474 | - finally | |
| 1475 | - response.Free; | |
| 1476 | - end; | |
| 1477 | -end; | |
| 1478 | - | |
| 1479 | -{ TKTWSAPI } | |
| 1480 | - | |
| 1481 | -{* | |
| 1482 | - Constructor | |
| 1483 | -*} | |
| 1484 | -constructor Tktwsapi.Create(); | |
| 1485 | -begin | |
| 1486 | - FSoapClient := GetKnowledgeTreePort(False, KTWebServiceUrl); | |
| 1487 | - FDownloadPath := ''; | |
| 1488 | -end; | |
| 1489 | - | |
| 1490 | -{* | |
| 1491 | - This returns the default location where documents are downloaded in download() and checkout(). | |
| 1492 | - | |
| 1493 | - @return string | |
| 1494 | -*} | |
| 1495 | -function TKTWSAPI.GetDownloadPath: WideString; | |
| 1496 | -begin | |
| 1497 | - Result := FDownloadPath; | |
| 1498 | -end; | |
| 1499 | - | |
| 1500 | -{* | |
| 1501 | - Allows the default location for downloaded documents to be changed. | |
| 1502 | - | |
| 1503 | - @param DownloadPath Path to writable folder | |
| 1504 | - @return true | |
| 1505 | -*} | |
| 1506 | -function TKTWSAPI.SetDownloadPath(DownloadPath: WideString): Boolean; | |
| 1507 | -begin | |
| 1508 | - if (not DirectoryExists(DownloadPath)) then | |
| 1509 | - raise EKTWSAPI_Exception.Create('local path is not writable'); | |
| 1510 | - // TODO : Check if folder is writable | |
| 1511 | - | |
| 1512 | - FDownloadPath := DownloadPath; | |
| 1513 | - Result := System.True; | |
| 1514 | -end; | |
| 1515 | - | |
| 1516 | -{* | |
| 1517 | - Starts an anonymous session. | |
| 1518 | - | |
| 1519 | - @param Ip Users Ip-adress | |
| 1520 | - @return Active session id | |
| 1521 | -*} | |
| 1522 | -function TKTWSAPI.StartAnonymousSession(Ip: WideString): WideString; | |
| 1523 | -begin | |
| 1524 | - Result := StartSession('anonymous', '', Ip); | |
| 1525 | -end; | |
| 1526 | - | |
| 1527 | -{* | |
| 1528 | - Starts a user session. | |
| 1529 | - | |
| 1530 | - @param Username Users username | |
| 1531 | - @param Password Users password | |
| 1532 | - @param Ip Users Ip-adress | |
| 1533 | - @return Active session id | |
| 1534 | - @throws EKTWSAPI_Exception KTWSAPI_ERR_SESSION_IN_USE | |
| 1535 | - @throws EKTWSAPI_Exception Response message | |
| 1536 | -*} | |
| 1537 | -function TKTWSAPI.StartSession(Username, Password, Ip: WideString): WideString; | |
| 1538 | -var | |
| 1539 | - response: kt_response; | |
| 1540 | -begin | |
| 1541 | - if (FSession <> '') then | |
| 1542 | - raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_IN_USE); | |
| 1543 | - response := FSoapClient.login(Username, Password, Ip); | |
| 1544 | - try | |
| 1545 | - if (response.status_code <> 0) then | |
| 1546 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1547 | - FSession := response.message_; | |
| 1548 | - Result := FSession; | |
| 1549 | - finally | |
| 1550 | - response.Free; | |
| 1551 | - end; | |
| 1552 | -end; | |
| 1553 | - | |
| 1554 | -{* | |
| 1555 | - Sets an active session. | |
| 1556 | - | |
| 1557 | - @param Session Session id to activate | |
| 1558 | - @param Ip Users Ip-adress | |
| 1559 | - @return Active session id | |
| 1560 | - @throws EKTWSAPI_Exception KTWSAPI_ERR_SESSION_IN_USE | |
| 1561 | -*} | |
| 1562 | -function TKTWSAPI.ActiveSession(Session, Ip: WideString): WideString; | |
| 1563 | -begin | |
| 1564 | - if (FSession <> '') then | |
| 1565 | - raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_IN_USE); | |
| 1566 | - FSession := Session; | |
| 1567 | - Result := FSession; | |
| 1568 | -end; | |
| 1569 | - | |
| 1570 | -{* | |
| 1571 | - Closes an active session. | |
| 1572 | - | |
| 1573 | - @return true | |
| 1574 | -*} | |
| 1575 | -function TKTWSAPI.Logout: Boolean; | |
| 1576 | -var | |
| 1577 | - response: kt_response; | |
| 1578 | -begin | |
| 1579 | - Result := System.False; | |
| 1580 | - | |
| 1581 | - if (FSession = '') then | |
| 1582 | - raise EKTWSAPI_Exception.Create(KTWSAPI_ERR_SESSION_NOT_STARTED); | |
| 1583 | - response := FSoapClient.logout(FSession); | |
| 1584 | - try | |
| 1585 | - if (response.status_code <> 0) then | |
| 1586 | - raise EKTWSAPI_Exception.Create(response.message_); | |
| 1587 | - FSession := ''; | |
| 1588 | - Result := System.True; | |
| 1589 | - finally | |
| 1590 | - response.Free; | |
| 1591 | - end; | |
| 1592 | -end; | |
| 1593 | - | |
| 1594 | -{* | |
| 1595 | - Returns a reference to the root folder. | |
| 1596 | - | |
| 1597 | - @return handle to folder | |
| 1598 | -*} | |
| 1599 | -function TKTWSAPI.GetRootFolder: TKTWSAPI_Folder; | |
| 1600 | -begin | |
| 1601 | - Result := GetFolderById(1); | |
| 1602 | -end; | |
| 1603 | - | |
| 1604 | -{* | |
| 1605 | - Returns a reference to a folder based on id. | |
| 1606 | - | |
| 1607 | - @param FolderId Id of folder | |
| 1608 | - @return handle to folder | |
| 1609 | -*} | |
| 1610 | -function TKTWSAPI.GetFolderById(FolderId: Integer): TKTWSAPI_Folder; | |
| 1611 | -begin | |
| 1612 | - if FSession = '' then | |
| 1613 | - raise EKTWSAPI_Exception.Create('A session is not active'); | |
| 1614 | - Result := TKTWSAPI_Folder.Get(Self, FolderId); | |
| 1615 | -end; | |
| 1616 | - | |
| 1617 | -{* | |
| 1618 | - Returns a reference to a document based on id. | |
| 1619 | - | |
| 1620 | - @param DocumentId Id of document | |
| 1621 | - @return handle to document | |
| 1622 | -*} | |
| 1623 | -function TKTWSAPI.GetDocumentById(DocumentId: Integer): TKTWSAPI_Document; | |
| 1624 | -begin | |
| 1625 | - if FSession = '' then | |
| 1626 | - raise EKTWSAPI_Exception.Create('A session is not active'); | |
| 1627 | - Result := TKTWSAPI_Document.Get(Self, DocumentId) | |
| 1628 | -end; | |
| 1629 | - | |
| 1630 | -end. |
ktwsapi/delphi/uwebservice.pas deleted
| 1 | -{ | |
| 2 | - Copyright (c) 2007, The Jam Warehouse Software (Pty) Ltd. | |
| 3 | - | |
| 4 | - All rights reserved. | |
| 5 | - | |
| 6 | - Redistribution and use in source and binary forms, with or without | |
| 7 | - modification, are permitted provided that the following conditions are met: | |
| 8 | - | |
| 9 | - i) Redistributions of source code must retain the above copyright notice, | |
| 10 | - this list of conditions and the following disclaimer. | |
| 11 | - ii) Redistributions in binary form must reproduce the above copyright | |
| 12 | - notice, this list of conditions and the following disclaimer in the | |
| 13 | - documentation and/or other materials provided with the distribution. | |
| 14 | - iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 15 | - names of its contributors may be used to endorse or promote products | |
| 16 | - derived from this software without specific prior written permission. | |
| 17 | - | |
| 18 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 | - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 22 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 23 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 24 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 25 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 26 | - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 27 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 28 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | -} | |
| 30 | - | |
| 31 | -{* | |
| 32 | - Unit auto-generated by delphi's wsdl imported | |
| 33 | - | |
| 34 | - @Author Bjarte Kalstveit Vebjørnsen <bjarte@macaos.com> | |
| 35 | - @Version 1.0 BKV 24.09.2007 Initial revision | |
| 36 | -*} | |
| 37 | - | |
| 38 | -// ************************************************************************ // | |
| 39 | -// The types declared in this file were generated from data read from the | |
| 40 | -// WSDL File described below: | |
| 41 | -// WSDL : http://ktdms.trunk/ktwebservice/webservice.php?wsdl | |
| 42 | -// Codegen : [wfDebug,wfGenerateWarnings,wfUseSerializerClassForAttrs] | |
| 43 | -// Version : 1.0 | |
| 44 | -// (23.09.2007 21:20:12 - 1.33.2.6) | |
| 45 | -// ************************************************************************ // | |
| 46 | - | |
| 47 | -unit uwebservice; | |
| 48 | - | |
| 49 | -interface | |
| 50 | - | |
| 51 | -uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; | |
| 52 | - | |
| 53 | -type | |
| 54 | - | |
| 55 | - // ************************************************************************ // | |
| 56 | - // The following types, referred to in the WSDL document are not being represented | |
| 57 | - // in this file. They are either aliases[@] of other types represented or were referred | |
| 58 | - // to but never[!] declared in the document. The types from the latter category | |
| 59 | - // typically map to predefined/known XML or Borland types; however, they could also | |
| 60 | - // indicate incorrect WSDL documents that failed to declare or import a schema type. | |
| 61 | - // ************************************************************************ // | |
| 62 | - // !:int - "http://www.w3.org/2001/XMLSchema" | |
| 63 | - // !:string - "http://www.w3.org/2001/XMLSchema" | |
| 64 | - // !:boolean - "http://www.w3.org/2001/XMLSchema" | |
| 65 | - | |
| 66 | - kt_response = class; { "urn:KnowledgeTree" } | |
| 67 | - kt_folder_detail = class; { "urn:KnowledgeTree" } | |
| 68 | - kt_folder_item = class; { "urn:KnowledgeTree" } | |
| 69 | - kt_folder_contents = class; { "urn:KnowledgeTree" } | |
| 70 | - kt_document_detail = class; { "urn:KnowledgeTree" } | |
| 71 | - kt_metadata_selection_item = class; { "urn:KnowledgeTree" } | |
| 72 | - kt_metadata_field = class; { "urn:KnowledgeTree" } | |
| 73 | - kt_metadata_fieldset = class; { "urn:KnowledgeTree" } | |
| 74 | - kt_metadata_response = class; { "urn:KnowledgeTree" } | |
| 75 | - kt_document_transitions_response = class; { "urn:KnowledgeTree" } | |
| 76 | - kt_document_transaction_history_item = class; { "urn:KnowledgeTree" } | |
| 77 | - kt_linked_document = class; { "urn:KnowledgeTree" } | |
| 78 | - kt_linked_document_response = class; { "urn:KnowledgeTree" } | |
| 79 | - kt_document_transaction_history_response = class; { "urn:KnowledgeTree" } | |
| 80 | - kt_document_version_history_item = class; { "urn:KnowledgeTree" } | |
| 81 | - kt_document_version_history_response = class; { "urn:KnowledgeTree" } | |
| 82 | - kt_document_types_response = class; { "urn:KnowledgeTree" } | |
| 83 | - | |
| 84 | - | |
| 85 | - | |
| 86 | - // ************************************************************************ // | |
| 87 | - // Namespace : urn:KnowledgeTree | |
| 88 | - // ************************************************************************ // | |
| 89 | - kt_response = class(TRemotable) | |
| 90 | - private | |
| 91 | - Fstatus_code: Integer; | |
| 92 | - Fmessage_: WideString; | |
| 93 | - published | |
| 94 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 95 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 96 | - end; | |
| 97 | - | |
| 98 | - | |
| 99 | - | |
| 100 | - // ************************************************************************ // | |
| 101 | - // Namespace : urn:KnowledgeTree | |
| 102 | - // ************************************************************************ // | |
| 103 | - kt_folder_detail = class(TRemotable) | |
| 104 | - private | |
| 105 | - Fstatus_code: Integer; | |
| 106 | - Fmessage_: WideString; | |
| 107 | - Fid: Integer; | |
| 108 | - Ffolder_name: WideString; | |
| 109 | - Fparent_id: Integer; | |
| 110 | - Ffull_path: WideString; | |
| 111 | - published | |
| 112 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 113 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 114 | - property id: Integer read Fid write Fid; | |
| 115 | - property folder_name: WideString read Ffolder_name write Ffolder_name; | |
| 116 | - property parent_id: Integer read Fparent_id write Fparent_id; | |
| 117 | - property full_path: WideString read Ffull_path write Ffull_path; | |
| 118 | - end; | |
| 119 | - | |
| 120 | - kt_folder_items = array of kt_folder_item; { "urn:KnowledgeTree" } | |
| 121 | - | |
| 122 | - | |
| 123 | - // ************************************************************************ // | |
| 124 | - // Namespace : urn:KnowledgeTree | |
| 125 | - // ************************************************************************ // | |
| 126 | - kt_folder_item = class(TRemotable) | |
| 127 | - private | |
| 128 | - Fid: Integer; | |
| 129 | - Fitem_type: WideString; | |
| 130 | - Ftitle: WideString; | |
| 131 | - Fcreator: WideString; | |
| 132 | - Fchecked_out_by: WideString; | |
| 133 | - Fmodified_by: WideString; | |
| 134 | - Ffilename: WideString; | |
| 135 | - Fsize: WideString; | |
| 136 | - Fmajor_version: WideString; | |
| 137 | - Fminor_version: WideString; | |
| 138 | - Fstorage_path: WideString; | |
| 139 | - Fmime_type: WideString; | |
| 140 | - Fmime_icon_path: WideString; | |
| 141 | - Fmime_display: WideString; | |
| 142 | - Fworkflow: WideString; | |
| 143 | - Fworkflow_state: WideString; | |
| 144 | - Fitems: kt_folder_items; | |
| 145 | - public | |
| 146 | - destructor Destroy; override; | |
| 147 | - published | |
| 148 | - property id: Integer read Fid write Fid; | |
| 149 | - property item_type: WideString read Fitem_type write Fitem_type; | |
| 150 | - property title: WideString read Ftitle write Ftitle; | |
| 151 | - property creator: WideString read Fcreator write Fcreator; | |
| 152 | - property checked_out_by: WideString read Fchecked_out_by write Fchecked_out_by; | |
| 153 | - property modified_by: WideString read Fmodified_by write Fmodified_by; | |
| 154 | - property filename: WideString read Ffilename write Ffilename; | |
| 155 | - property size: WideString read Fsize write Fsize; | |
| 156 | - property major_version: WideString read Fmajor_version write Fmajor_version; | |
| 157 | - property minor_version: WideString read Fminor_version write Fminor_version; | |
| 158 | - property storage_path: WideString read Fstorage_path write Fstorage_path; | |
| 159 | - property mime_type: WideString read Fmime_type write Fmime_type; | |
| 160 | - property mime_icon_path: WideString read Fmime_icon_path write Fmime_icon_path; | |
| 161 | - property mime_display: WideString read Fmime_display write Fmime_display; | |
| 162 | - property workflow: WideString read Fworkflow write Fworkflow; | |
| 163 | - property workflow_state: WideString read Fworkflow_state write Fworkflow_state; | |
| 164 | - property items: kt_folder_items read Fitems write Fitems; | |
| 165 | - end; | |
| 166 | - | |
| 167 | - | |
| 168 | - | |
| 169 | - // ************************************************************************ // | |
| 170 | - // Namespace : urn:KnowledgeTree | |
| 171 | - // ************************************************************************ // | |
| 172 | - kt_folder_contents = class(TRemotable) | |
| 173 | - private | |
| 174 | - Fstatus_code: Integer; | |
| 175 | - Fmessage_: WideString; | |
| 176 | - Ffolder_id: Integer; | |
| 177 | - Ffolder_name: WideString; | |
| 178 | - Ffull_path: WideString; | |
| 179 | - Fitems: kt_folder_items; | |
| 180 | - public | |
| 181 | - destructor Destroy; override; | |
| 182 | - published | |
| 183 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 184 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 185 | - property folder_id: Integer read Ffolder_id write Ffolder_id; | |
| 186 | - property folder_name: WideString read Ffolder_name write Ffolder_name; | |
| 187 | - property full_path: WideString read Ffull_path write Ffull_path; | |
| 188 | - property items: kt_folder_items read Fitems write Fitems; | |
| 189 | - end; | |
| 190 | - | |
| 191 | - | |
| 192 | - | |
| 193 | - // ************************************************************************ // | |
| 194 | - // Namespace : urn:KnowledgeTree | |
| 195 | - // ************************************************************************ // | |
| 196 | - kt_document_detail = class(TRemotable) | |
| 197 | - private | |
| 198 | - Fstatus_code: Integer; | |
| 199 | - Fmessage_: WideString; | |
| 200 | - Ftitle: WideString; | |
| 201 | - Fdocument_type: WideString; | |
| 202 | - Fversion: WideString; | |
| 203 | - Ffilename: WideString; | |
| 204 | - Fcreated_date: WideString; | |
| 205 | - Fcreated_by: WideString; | |
| 206 | - Fupdated_date: WideString; | |
| 207 | - Fupdated_by: WideString; | |
| 208 | - Fdocument_id: Integer; | |
| 209 | - Ffolder_id: Integer; | |
| 210 | - Fworkflow: WideString; | |
| 211 | - Fworkflow_state: WideString; | |
| 212 | - Fcheckout_by: WideString; | |
| 213 | - Ffull_path: WideString; | |
| 214 | - published | |
| 215 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 216 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 217 | - property title: WideString read Ftitle write Ftitle; | |
| 218 | - property document_type: WideString read Fdocument_type write Fdocument_type; | |
| 219 | - property version: WideString read Fversion write Fversion; | |
| 220 | - property filename: WideString read Ffilename write Ffilename; | |
| 221 | - property created_date: WideString read Fcreated_date write Fcreated_date; | |
| 222 | - property created_by: WideString read Fcreated_by write Fcreated_by; | |
| 223 | - property updated_date: WideString read Fupdated_date write Fupdated_date; | |
| 224 | - property updated_by: WideString read Fupdated_by write Fupdated_by; | |
| 225 | - property document_id: Integer read Fdocument_id write Fdocument_id; | |
| 226 | - property folder_id: Integer read Ffolder_id write Ffolder_id; | |
| 227 | - property workflow: WideString read Fworkflow write Fworkflow; | |
| 228 | - property workflow_state: WideString read Fworkflow_state write Fworkflow_state; | |
| 229 | - property checkout_by: WideString read Fcheckout_by write Fcheckout_by; | |
| 230 | - property full_path: WideString read Ffull_path write Ffull_path; | |
| 231 | - end; | |
| 232 | - | |
| 233 | - | |
| 234 | - | |
| 235 | - // ************************************************************************ // | |
| 236 | - // Namespace : urn:KnowledgeTree | |
| 237 | - // ************************************************************************ // | |
| 238 | - kt_metadata_selection_item = class(TRemotable) | |
| 239 | - private | |
| 240 | - Fid: Integer; | |
| 241 | - Fname_: WideString; | |
| 242 | - Fvalue: WideString; | |
| 243 | - Fparent_id: Integer; | |
| 244 | - published | |
| 245 | - property id: Integer read Fid write Fid; | |
| 246 | - property name_: WideString read Fname_ write Fname_; | |
| 247 | - property value: WideString read Fvalue write Fvalue; | |
| 248 | - property parent_id: Integer read Fparent_id write Fparent_id; | |
| 249 | - end; | |
| 250 | - | |
| 251 | - kt_metadata_selection = array of kt_metadata_selection_item; { "urn:KnowledgeTree" } | |
| 252 | - | |
| 253 | - | |
| 254 | - // ************************************************************************ // | |
| 255 | - // Namespace : urn:KnowledgeTree | |
| 256 | - // ************************************************************************ // | |
| 257 | - kt_metadata_field = class(TRemotable) | |
| 258 | - private | |
| 259 | - Fname_: WideString; | |
| 260 | - Frequired: Boolean; | |
| 261 | - Fvalue: WideString; | |
| 262 | - Fdescription: WideString; | |
| 263 | - Fcontrol_type: WideString; | |
| 264 | - Fselection: kt_metadata_selection; | |
| 265 | - public | |
| 266 | - destructor Destroy; override; | |
| 267 | - published | |
| 268 | - property name_: WideString read Fname_ write Fname_; | |
| 269 | - property required: Boolean read Frequired write Frequired; | |
| 270 | - property value: WideString read Fvalue write Fvalue; | |
| 271 | - property description: WideString read Fdescription write Fdescription; | |
| 272 | - property control_type: WideString read Fcontrol_type write Fcontrol_type; | |
| 273 | - property selection: kt_metadata_selection read Fselection write Fselection; | |
| 274 | - end; | |
| 275 | - | |
| 276 | - kt_metadata_fields = array of kt_metadata_field; { "urn:KnowledgeTree" } | |
| 277 | - | |
| 278 | - | |
| 279 | - // ************************************************************************ // | |
| 280 | - // Namespace : urn:KnowledgeTree | |
| 281 | - // ************************************************************************ // | |
| 282 | - kt_metadata_fieldset = class(TRemotable) | |
| 283 | - private | |
| 284 | - Ffieldset: WideString; | |
| 285 | - Fdescription: WideString; | |
| 286 | - Ffields: kt_metadata_fields; | |
| 287 | - public | |
| 288 | - destructor Destroy; override; | |
| 289 | - published | |
| 290 | - property fieldset: WideString read Ffieldset write Ffieldset; | |
| 291 | - property description: WideString read Fdescription write Fdescription; | |
| 292 | - property fields: kt_metadata_fields read Ffields write Ffields; | |
| 293 | - end; | |
| 294 | - | |
| 295 | - kt_metadata_fieldsets = array of kt_metadata_fieldset; { "urn:KnowledgeTree" } | |
| 296 | - | |
| 297 | - | |
| 298 | - // ************************************************************************ // | |
| 299 | - // Namespace : urn:KnowledgeTree | |
| 300 | - // ************************************************************************ // | |
| 301 | - kt_metadata_response = class(TRemotable) | |
| 302 | - private | |
| 303 | - Fstatus_code: Integer; | |
| 304 | - Fmessage_: WideString; | |
| 305 | - Fmetadata: kt_metadata_fieldsets; | |
| 306 | - public | |
| 307 | - destructor Destroy; override; | |
| 308 | - published | |
| 309 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 310 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 311 | - property metadata: kt_metadata_fieldsets read Fmetadata write Fmetadata; | |
| 312 | - end; | |
| 313 | - | |
| 314 | - kt_document_transitions = array of WideString; { "urn:KnowledgeTree" } | |
| 315 | - | |
| 316 | - | |
| 317 | - // ************************************************************************ // | |
| 318 | - // Namespace : urn:KnowledgeTree | |
| 319 | - // ************************************************************************ // | |
| 320 | - kt_document_transitions_response = class(TRemotable) | |
| 321 | - private | |
| 322 | - Fstatus_code: Integer; | |
| 323 | - Fmessage_: WideString; | |
| 324 | - Fmetadata: kt_document_transitions; | |
| 325 | - published | |
| 326 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 327 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 328 | - property metadata: kt_document_transitions read Fmetadata write Fmetadata; | |
| 329 | - end; | |
| 330 | - | |
| 331 | - | |
| 332 | - | |
| 333 | - // ************************************************************************ // | |
| 334 | - // Namespace : urn:KnowledgeTree | |
| 335 | - // ************************************************************************ // | |
| 336 | - kt_document_transaction_history_item = class(TRemotable) | |
| 337 | - private | |
| 338 | - Ftransaction_name: WideString; | |
| 339 | - Fusername: WideString; | |
| 340 | - Fversion: WideString; | |
| 341 | - Fcomment: WideString; | |
| 342 | - Fdatetime: WideString; | |
| 343 | - published | |
| 344 | - property transaction_name: WideString read Ftransaction_name write Ftransaction_name; | |
| 345 | - property username: WideString read Fusername write Fusername; | |
| 346 | - property version: WideString read Fversion write Fversion; | |
| 347 | - property comment: WideString read Fcomment write Fcomment; | |
| 348 | - property datetime: WideString read Fdatetime write Fdatetime; | |
| 349 | - end; | |
| 350 | - | |
| 351 | - | |
| 352 | - | |
| 353 | - // ************************************************************************ // | |
| 354 | - // Namespace : urn:KnowledgeTree | |
| 355 | - // ************************************************************************ // | |
| 356 | - kt_linked_document = class(TRemotable) | |
| 357 | - private | |
| 358 | - Fdocument_id: Integer; | |
| 359 | - Ftitle: WideString; | |
| 360 | - Fsize: Integer; | |
| 361 | - Fworkflow: WideString; | |
| 362 | - Fworkflow_state: WideString; | |
| 363 | - Flink_type: WideString; | |
| 364 | - published | |
| 365 | - property document_id: Integer read Fdocument_id write Fdocument_id; | |
| 366 | - property title: WideString read Ftitle write Ftitle; | |
| 367 | - property size: Integer read Fsize write Fsize; | |
| 368 | - property workflow: WideString read Fworkflow write Fworkflow; | |
| 369 | - property workflow_state: WideString read Fworkflow_state write Fworkflow_state; | |
| 370 | - property link_type: WideString read Flink_type write Flink_type; | |
| 371 | - end; | |
| 372 | - | |
| 373 | - kt_linked_documents = array of kt_linked_document; { "urn:KnowledgeTree" } | |
| 374 | - | |
| 375 | - | |
| 376 | - // ************************************************************************ // | |
| 377 | - // Namespace : urn:KnowledgeTree | |
| 378 | - // ************************************************************************ // | |
| 379 | - kt_linked_document_response = class(TRemotable) | |
| 380 | - private | |
| 381 | - Fstatus_code: Integer; | |
| 382 | - Fmessage_: WideString; | |
| 383 | - Fparent_document_id: WideString; | |
| 384 | - Flinks: kt_linked_documents; | |
| 385 | - public | |
| 386 | - destructor Destroy; override; | |
| 387 | - published | |
| 388 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 389 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 390 | - property parent_document_id: WideString read Fparent_document_id write Fparent_document_id; | |
| 391 | - property links: kt_linked_documents read Flinks write Flinks; | |
| 392 | - end; | |
| 393 | - | |
| 394 | - kt_document_transaction_history = array of kt_document_transaction_history_item; { "urn:KnowledgeTree" } | |
| 395 | - | |
| 396 | - | |
| 397 | - // ************************************************************************ // | |
| 398 | - // Namespace : urn:KnowledgeTree | |
| 399 | - // ************************************************************************ // | |
| 400 | - kt_document_transaction_history_response = class(TRemotable) | |
| 401 | - private | |
| 402 | - Fstatus_code: Integer; | |
| 403 | - Fmessage_: WideString; | |
| 404 | - Fhistory: kt_document_transaction_history; | |
| 405 | - public | |
| 406 | - destructor Destroy; override; | |
| 407 | - published | |
| 408 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 409 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 410 | - property history: kt_document_transaction_history read Fhistory write Fhistory; | |
| 411 | - end; | |
| 412 | - | |
| 413 | - | |
| 414 | - | |
| 415 | - // ************************************************************************ // | |
| 416 | - // Namespace : urn:KnowledgeTree | |
| 417 | - // ************************************************************************ // | |
| 418 | - kt_document_version_history_item = class(TRemotable) | |
| 419 | - private | |
| 420 | - Fuser: Integer; | |
| 421 | - Fmetadata_version: WideString; | |
| 422 | - Fcontent_version: WideString; | |
| 423 | - published | |
| 424 | - property user: Integer read Fuser write Fuser; | |
| 425 | - property metadata_version: WideString read Fmetadata_version write Fmetadata_version; | |
| 426 | - property content_version: WideString read Fcontent_version write Fcontent_version; | |
| 427 | - end; | |
| 428 | - | |
| 429 | - kt_document_version_history = array of kt_document_version_history_item; { "urn:KnowledgeTree" } | |
| 430 | - | |
| 431 | - | |
| 432 | - // ************************************************************************ // | |
| 433 | - // Namespace : urn:KnowledgeTree | |
| 434 | - // ************************************************************************ // | |
| 435 | - kt_document_version_history_response = class(TRemotable) | |
| 436 | - private | |
| 437 | - Fstatus_code: Integer; | |
| 438 | - Fmessage_: WideString; | |
| 439 | - Fhistory: kt_document_version_history; | |
| 440 | - public | |
| 441 | - destructor Destroy; override; | |
| 442 | - published | |
| 443 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 444 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 445 | - property history: kt_document_version_history read Fhistory write Fhistory; | |
| 446 | - end; | |
| 447 | - | |
| 448 | - kt_document_types_array = array of WideString; { "urn:KnowledgeTree" } | |
| 449 | - | |
| 450 | - | |
| 451 | - // ************************************************************************ // | |
| 452 | - // Namespace : urn:KnowledgeTree | |
| 453 | - // ************************************************************************ // | |
| 454 | - kt_document_types_response = class(TRemotable) | |
| 455 | - private | |
| 456 | - Fstatus_code: Integer; | |
| 457 | - Fmessage_: WideString; | |
| 458 | - Fdocument_types: kt_document_types_array; | |
| 459 | - published | |
| 460 | - property status_code: Integer read Fstatus_code write Fstatus_code; | |
| 461 | - property message_: WideString read Fmessage_ write Fmessage_; | |
| 462 | - property document_types: kt_document_types_array read Fdocument_types write Fdocument_types; | |
| 463 | - end; | |
| 464 | - | |
| 465 | - | |
| 466 | - // ************************************************************************ // | |
| 467 | - // Namespace : http://schemas.xmlsoap.org/soap/envelope/ | |
| 468 | - // soapAction: http://schemas.xmlsoap.org/soap/envelope/#KTWebService#%operationName% | |
| 469 | - // transport : http://schemas.xmlsoap.org/soap/http | |
| 470 | - // style : rpc | |
| 471 | - // binding : KnowledgeTreeBinding | |
| 472 | - // service : KnowledgeTreeService | |
| 473 | - // port : KnowledgeTreePort | |
| 474 | - // URL : http://ktdms.trunk/ktwebservice/webservice.php | |
| 475 | - // ************************************************************************ // | |
| 476 | - KnowledgeTreePort = interface(IInvokable) | |
| 477 | - ['{FA35CA60-1DC3-B3C7-6C65-BE4E3A6A8A22}'] | |
| 478 | - function login(const username: WideString; const password: WideString; const ip: WideString): kt_response; stdcall; | |
| 479 | - function anonymous_login(const ip: WideString): kt_response; stdcall; | |
| 480 | - function logout(const session_id: WideString): kt_response; stdcall; | |
| 481 | - function get_folder_detail(const session_id: WideString; const folder_id: Integer): kt_folder_detail; stdcall; | |
| 482 | - function get_folder_detail_by_name(const session_id: WideString; const folder_name: WideString): kt_folder_detail; stdcall; | |
| 483 | - function get_folder_contents(const session_id: WideString; const folder_id: Integer; const depth: Integer; const what: WideString): kt_folder_contents; stdcall; | |
| 484 | - function create_folder(const session_id: WideString; const folder_id: Integer; const folder_name: WideString): kt_folder_detail; stdcall; | |
| 485 | - function delete_folder(const session_id: WideString; const folder_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 486 | - function rename_folder(const session_id: WideString; const folder_id: Integer; const newname: WideString): kt_response; stdcall; | |
| 487 | - function get_document_links(const session_id: WideString; const document_id: Integer): kt_linked_document_response; stdcall; | |
| 488 | - function link_documents(const session_id: WideString; const parent_document_id: Integer; const child_document_id: Integer; const type_: WideString): kt_response; stdcall; | |
| 489 | - function unlink_documents(const session_id: WideString; const parent_document_id: Integer; const child_document_id: Integer): kt_response; stdcall; | |
| 490 | - function copy_folder(const session_id: WideString; const source_id: Integer; const target_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 491 | - function move_folder(const session_id: WideString; const source_id: Integer; const target_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 492 | - function get_document_detail(const session_id: WideString; const document_id: Integer): kt_document_detail; stdcall; | |
| 493 | - 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; | |
| 494 | - 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; | |
| 495 | - 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; | |
| 496 | - 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; | |
| 497 | - 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; | |
| 498 | - 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; | |
| 499 | - function get_document_detail_by_name(const session_id: WideString; const document_name: WideString; const what: WideString): kt_document_detail; stdcall; | |
| 500 | - function checkout_document(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 501 | - function checkout_small_document(const session_id: WideString; const document_id: Integer; const reason: WideString; const download: Boolean): kt_response; stdcall; | |
| 502 | - function checkout_base64_document(const session_id: WideString; const document_id: Integer; const reason: WideString; const download: Boolean): kt_response; stdcall; | |
| 503 | - function undo_document_checkout(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 504 | - function download_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall; | |
| 505 | - function download_small_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall; | |
| 506 | - function download_base64_document(const session_id: WideString; const document_id: Integer): kt_response; stdcall; | |
| 507 | - function delete_document(const session_id: WideString; const document_id: Integer; const reason: WideString): kt_response; stdcall; | |
| 508 | - function change_document_owner(const session_id: WideString; const document_id: Integer; const username: WideString; const reason: WideString): kt_response; stdcall; | |
| 509 | - 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; | |
| 510 | - 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; | |
| 511 | - function rename_document_title(const session_id: WideString; const document_id: Integer; const newtitle: WideString): kt_response; stdcall; | |
| 512 | - function rename_document_filename(const session_id: WideString; const document_id: Integer; const newfilename: WideString): kt_response; stdcall; | |
| 513 | - function change_document_type(const session_id: WideString; const document_id: Integer; const documenttype: WideString): kt_response; stdcall; | |
| 514 | - function start_document_workflow(const session_id: WideString; const document_id: Integer; const workflow: WideString): kt_response; stdcall; | |
| 515 | - function delete_document_workflow(const session_id: WideString; const document_id: Integer): kt_response; stdcall; | |
| 516 | - function perform_document_workflow_transition(const session_id: WideString; const document_id: Integer; const transition: WideString; const reason: WideString): kt_response; stdcall; | |
| 517 | - function get_document_metadata(const session_id: WideString; const document_id: Integer): kt_metadata_response; stdcall; | |
| 518 | - function get_document_type_metadata(const session_id: WideString; const document_type: WideString): kt_metadata_response; stdcall; | |
| 519 | - function update_document_metadata(const session_id: WideString; const document_id: Integer; const metadata: kt_metadata_fieldsets): kt_response; stdcall; | |
| 520 | - function get_document_workflow_transitions(const session_id: WideString; const document_id: Integer): kt_document_transitions_response; stdcall; | |
| 521 | - function get_document_workflow_state(const session_id: WideString; const document_id: Integer): kt_response; stdcall; | |
| 522 | - function get_document_transaction_history(const session_id: WideString; const document_id: Integer): kt_document_transaction_history_response; stdcall; | |
| 523 | - function get_document_version_history(const session_id: WideString; const document_id: Integer): kt_document_version_history_response; stdcall; | |
| 524 | - function get_document_types(const session_id: WideString): kt_document_types_response; stdcall; | |
| 525 | - function get_document_link_types(const session_id: WideString): kt_document_types_response; stdcall; | |
| 526 | - end; | |
| 527 | - | |
| 528 | -function GetKnowledgeTreePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): KnowledgeTreePort; | |
| 529 | - | |
| 530 | - | |
| 531 | -implementation | |
| 532 | - | |
| 533 | -function GetKnowledgeTreePort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): KnowledgeTreePort; | |
| 534 | -const | |
| 535 | - defWSDL = 'http://ktdms.trunk/ktwebservice/webservice.php?wsdl'; | |
| 536 | - defURL = 'http://ktdms.trunk/ktwebservice/webservice.php'; | |
| 537 | - defSvc = 'KnowledgeTreeService'; | |
| 538 | - defPrt = 'KnowledgeTreePort'; | |
| 539 | -var | |
| 540 | - RIO: THTTPRIO; | |
| 541 | -begin | |
| 542 | - Result := nil; | |
| 543 | - if (Addr = '') then | |
| 544 | - begin | |
| 545 | - if UseWSDL then | |
| 546 | - Addr := defWSDL | |
| 547 | - else | |
| 548 | - Addr := defURL; | |
| 549 | - end; | |
| 550 | - if HTTPRIO = nil then | |
| 551 | - RIO := THTTPRIO.Create(nil) | |
| 552 | - else | |
| 553 | - RIO := HTTPRIO; | |
| 554 | - try | |
| 555 | - Result := (RIO as KnowledgeTreePort); | |
| 556 | - if UseWSDL then | |
| 557 | - begin | |
| 558 | - RIO.WSDLLocation := Addr; | |
| 559 | - RIO.Service := defSvc; | |
| 560 | - RIO.Port := defPrt; | |
| 561 | - end else | |
| 562 | - RIO.URL := Addr; | |
| 563 | - finally | |
| 564 | - if (Result = nil) and (HTTPRIO = nil) then | |
| 565 | - RIO.Free; | |
| 566 | - end; | |
| 567 | -end; | |
| 568 | - | |
| 569 | - | |
| 570 | -destructor kt_folder_item.Destroy; | |
| 571 | -var | |
| 572 | - I: Integer; | |
| 573 | -begin | |
| 574 | - for I := 0 to Length(Fitems)-1 do | |
| 575 | - if Assigned(Fitems[I]) then | |
| 576 | - Fitems[I].Free; | |
| 577 | - SetLength(Fitems, 0); | |
| 578 | - inherited Destroy; | |
| 579 | -end; | |
| 580 | - | |
| 581 | -destructor kt_folder_contents.Destroy; | |
| 582 | -var | |
| 583 | - I: Integer; | |
| 584 | -begin | |
| 585 | - for I := 0 to Length(Fitems)-1 do | |
| 586 | - if Assigned(Fitems[I]) then | |
| 587 | - Fitems[I].Free; | |
| 588 | - SetLength(Fitems, 0); | |
| 589 | - inherited Destroy; | |
| 590 | -end; | |
| 591 | - | |
| 592 | -destructor kt_metadata_field.Destroy; | |
| 593 | -var | |
| 594 | - I: Integer; | |
| 595 | -begin | |
| 596 | - for I := 0 to Length(Fselection)-1 do | |
| 597 | - if Assigned(Fselection[I]) then | |
| 598 | - Fselection[I].Free; | |
| 599 | - SetLength(Fselection, 0); | |
| 600 | - inherited Destroy; | |
| 601 | -end; | |
| 602 | - | |
| 603 | -destructor kt_metadata_fieldset.Destroy; | |
| 604 | -var | |
| 605 | - I: Integer; | |
| 606 | -begin | |
| 607 | - for I := 0 to Length(Ffields)-1 do | |
| 608 | - if Assigned(Ffields[I]) then | |
| 609 | - Ffields[I].Free; | |
| 610 | - SetLength(Ffields, 0); | |
| 611 | - inherited Destroy; | |
| 612 | -end; | |
| 613 | - | |
| 614 | -destructor kt_metadata_response.Destroy; | |
| 615 | -var | |
| 616 | - I: Integer; | |
| 617 | -begin | |
| 618 | - for I := 0 to Length(Fmetadata)-1 do | |
| 619 | - if Assigned(Fmetadata[I]) then | |
| 620 | - Fmetadata[I].Free; | |
| 621 | - SetLength(Fmetadata, 0); | |
| 622 | - inherited Destroy; | |
| 623 | -end; | |
| 624 | - | |
| 625 | -destructor kt_linked_document_response.Destroy; | |
| 626 | -var | |
| 627 | - I: Integer; | |
| 628 | -begin | |
| 629 | - for I := 0 to Length(Flinks)-1 do | |
| 630 | - if Assigned(Flinks[I]) then | |
| 631 | - Flinks[I].Free; | |
| 632 | - SetLength(Flinks, 0); | |
| 633 | - inherited Destroy; | |
| 634 | -end; | |
| 635 | - | |
| 636 | -destructor kt_document_transaction_history_response.Destroy; | |
| 637 | -var | |
| 638 | - I: Integer; | |
| 639 | -begin | |
| 640 | - for I := 0 to Length(Fhistory)-1 do | |
| 641 | - if Assigned(Fhistory[I]) then | |
| 642 | - Fhistory[I].Free; | |
| 643 | - SetLength(Fhistory, 0); | |
| 644 | - inherited Destroy; | |
| 645 | -end; | |
| 646 | - | |
| 647 | -destructor kt_document_version_history_response.Destroy; | |
| 648 | -var | |
| 649 | - I: Integer; | |
| 650 | -begin | |
| 651 | - for I := 0 to Length(Fhistory)-1 do | |
| 652 | - if Assigned(Fhistory[I]) then | |
| 653 | - Fhistory[I].Free; | |
| 654 | - SetLength(Fhistory, 0); | |
| 655 | - inherited Destroy; | |
| 656 | -end; | |
| 657 | - | |
| 658 | -initialization | |
| 659 | - InvRegistry.RegisterInterface(TypeInfo(KnowledgeTreePort), 'http://schemas.xmlsoap.org/soap/envelope/', ''); | |
| 660 | - InvRegistry.RegisterDefaultSOAPAction(TypeInfo(KnowledgeTreePort), 'http://schemas.xmlsoap.org/soap/envelope/#KTWebService#%operationName%'); | |
| 661 | - InvRegistry.RegisterExternalParamName(TypeInfo(KnowledgeTreePort), 'link_documents', 'type_', 'type'); | |
| 662 | - RemClassRegistry.RegisterXSClass(kt_response, 'urn:KnowledgeTree', 'kt_response'); | |
| 663 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_response), 'message_', 'message'); | |
| 664 | - RemClassRegistry.RegisterXSClass(kt_folder_detail, 'urn:KnowledgeTree', 'kt_folder_detail'); | |
| 665 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_folder_detail), 'message_', 'message'); | |
| 666 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_folder_items), 'urn:KnowledgeTree', 'kt_folder_items'); | |
| 667 | - RemClassRegistry.RegisterXSClass(kt_folder_item, 'urn:KnowledgeTree', 'kt_folder_item'); | |
| 668 | - RemClassRegistry.RegisterXSClass(kt_folder_contents, 'urn:KnowledgeTree', 'kt_folder_contents'); | |
| 669 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_folder_contents), 'message_', 'message'); | |
| 670 | - RemClassRegistry.RegisterXSClass(kt_document_detail, 'urn:KnowledgeTree', 'kt_document_detail'); | |
| 671 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_detail), 'message_', 'message'); | |
| 672 | - RemClassRegistry.RegisterXSClass(kt_metadata_selection_item, 'urn:KnowledgeTree', 'kt_metadata_selection_item'); | |
| 673 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_selection_item), 'name_', 'name'); | |
| 674 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_selection), 'urn:KnowledgeTree', 'kt_metadata_selection'); | |
| 675 | - RemClassRegistry.RegisterXSClass(kt_metadata_field, 'urn:KnowledgeTree', 'kt_metadata_field'); | |
| 676 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_field), 'name_', 'name'); | |
| 677 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_fields), 'urn:KnowledgeTree', 'kt_metadata_fields'); | |
| 678 | - RemClassRegistry.RegisterXSClass(kt_metadata_fieldset, 'urn:KnowledgeTree', 'kt_metadata_fieldset'); | |
| 679 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_metadata_fieldsets), 'urn:KnowledgeTree', 'kt_metadata_fieldsets'); | |
| 680 | - RemClassRegistry.RegisterXSClass(kt_metadata_response, 'urn:KnowledgeTree', 'kt_metadata_response'); | |
| 681 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_metadata_response), 'message_', 'message'); | |
| 682 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_transitions), 'urn:KnowledgeTree', 'kt_document_transitions'); | |
| 683 | - RemClassRegistry.RegisterXSClass(kt_document_transitions_response, 'urn:KnowledgeTree', 'kt_document_transitions_response'); | |
| 684 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_transitions_response), 'message_', 'message'); | |
| 685 | - RemClassRegistry.RegisterXSClass(kt_document_transaction_history_item, 'urn:KnowledgeTree', 'kt_document_transaction_history_item'); | |
| 686 | - RemClassRegistry.RegisterXSClass(kt_linked_document, 'urn:KnowledgeTree', 'kt_linked_document'); | |
| 687 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_linked_documents), 'urn:KnowledgeTree', 'kt_linked_documents'); | |
| 688 | - RemClassRegistry.RegisterXSClass(kt_linked_document_response, 'urn:KnowledgeTree', 'kt_linked_document_response'); | |
| 689 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_linked_document_response), 'message_', 'message'); | |
| 690 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_transaction_history), 'urn:KnowledgeTree', 'kt_document_transaction_history'); | |
| 691 | - RemClassRegistry.RegisterXSClass(kt_document_transaction_history_response, 'urn:KnowledgeTree', 'kt_document_transaction_history_response'); | |
| 692 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_transaction_history_response), 'message_', 'message'); | |
| 693 | - RemClassRegistry.RegisterXSClass(kt_document_version_history_item, 'urn:KnowledgeTree', 'kt_document_version_history_item'); | |
| 694 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_version_history), 'urn:KnowledgeTree', 'kt_document_version_history'); | |
| 695 | - RemClassRegistry.RegisterXSClass(kt_document_version_history_response, 'urn:KnowledgeTree', 'kt_document_version_history_response'); | |
| 696 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_version_history_response), 'message_', 'message'); | |
| 697 | - RemClassRegistry.RegisterXSInfo(TypeInfo(kt_document_types_array), 'urn:KnowledgeTree', 'kt_document_types_array'); | |
| 698 | - RemClassRegistry.RegisterXSClass(kt_document_types_response, 'urn:KnowledgeTree', 'kt_document_types_response'); | |
| 699 | - RemClassRegistry.RegisterExternalPropName(TypeInfo(kt_document_types_response), 'message_', 'message'); | |
| 700 | - | |
| 701 | -end. |
ktwsapi/dotnet/TODO.txt deleted
ktwsapi/java/TODO.txt deleted
ktwsapi/php/docs/INSTALL.txt deleted
| 1 | -KnowledgeTree Web Server Object Model - PHP Edition | |
| 2 | -=================================================== | |
| 3 | - | |
| 4 | -The KTWSAPI PHP edition implements the object model wrapping the web services. It can thus be deployed on | |
| 5 | -a remote machine independant of the actual KnowledgeTree installation. | |
| 6 | - | |
| 7 | -Dependencies | |
| 8 | -============ | |
| 9 | -1) libcurl | |
| 10 | -2) PEAR::SOAP | |
| 11 | - | |
| 12 | -Installation | |
| 13 | -============ | |
| 14 | - | |
| 15 | -Copy the ktwsapi/php folder to some location in your project. | |
| 16 | - | |
| 17 | -Update ktwsapi_cfg.inc.php with the appropriate settings for your system. | |
| 18 | - | |
| 19 | -Examples | |
| 20 | -======== | |
| 21 | - | |
| 22 | -There are some examples in the ktwsapi/php/examples folder. | |
| 23 | - |
ktwsapi/php/examples/ktws_eg_add_document.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * This is a sample of how to add a document to the repository. | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -$response = $ktapi->start_session('admin','admin'); | |
| 41 | -if (PEAR::isError($response)) | |
| 42 | -{ | |
| 43 | - print $response->getMessage(); | |
| 44 | - exit; | |
| 45 | -} | |
| 46 | - | |
| 47 | -$root = $ktapi->get_root_folder(); | |
| 48 | - | |
| 49 | -$root->add_document('c:/temp/test.doc'); | |
| 50 | - | |
| 51 | -$ktapi->logout(); | |
| 52 | - | |
| 53 | -?> |
ktwsapi/php/examples/ktws_eg_anonymous.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * Demonstrates how to create an anonymous session. | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -$response = $ktapi->start_anonymous_session(); | |
| 41 | -if (PEAR::isError($response)) | |
| 42 | -{ | |
| 43 | - print $response->getMessage(); | |
| 44 | - exit; | |
| 45 | -} | |
| 46 | - | |
| 47 | -// do something | |
| 48 | - | |
| 49 | -$root=$ktapi->get_root_folder(); | |
| 50 | - | |
| 51 | -// when done, logout | |
| 52 | - | |
| 53 | - | |
| 54 | -$ktapi->logout(); | |
| 55 | - | |
| 56 | -?> |
ktwsapi/php/examples/ktws_eg_checkin.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * Demonstrates document checkout and checkin | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -// change session to something that is in table 'active_sessions' | |
| 41 | - | |
| 42 | -$response = $ktapi->active_session('sj5827sohdoj6h3nvifrcsa1f2'); | |
| 43 | -if (PEAR::isError($response)) | |
| 44 | -{ | |
| 45 | - print $response->getMessage(); | |
| 46 | - exit; | |
| 47 | -} | |
| 48 | - | |
| 49 | -$root = $ktapi->get_root_folder(); | |
| 50 | -if (PEAR::isError($root)) | |
| 51 | -{ | |
| 52 | - print $root->getMessage(); | |
| 53 | - exit; | |
| 54 | -} | |
| 55 | - | |
| 56 | -$document = $root->add_document('c:/temp/test.doc'); | |
| 57 | -if (PEAR::isError($document)) | |
| 58 | -{ | |
| 59 | - print $document->getMessage(); | |
| 60 | - exit; | |
| 61 | -} | |
| 62 | - | |
| 63 | -$result = $document->checkout('going to update','c:/'); | |
| 64 | -if (PEAR::isError($result)) | |
| 65 | -{ | |
| 66 | - print $result->getMessage(); | |
| 67 | - exit; | |
| 68 | -} | |
| 69 | - | |
| 70 | -$result = $document->checkin('c:/test.doc','have updated',false); | |
| 71 | -if (PEAR::isError($result)) | |
| 72 | -{ | |
| 73 | - print $result->getMessage(); | |
| 74 | - exit; | |
| 75 | -} | |
| 76 | - | |
| 77 | -$ktapi->logout(); | |
| 78 | - | |
| 79 | -?> |
ktwsapi/php/examples/ktws_eg_create_folder.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * Demonstrates creating a folder in an active session. | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -// change session to something that is in table 'active_sessions' | |
| 41 | - | |
| 42 | -$response = $ktapi->active_session('qekolkpkk9mq2nlc31ghndi1l2'); | |
| 43 | -if (PEAR::isError($response)) | |
| 44 | -{ | |
| 45 | - print $response->getMessage(); | |
| 46 | - exit; | |
| 47 | -} | |
| 48 | - | |
| 49 | -$root = $ktapi->get_root_folder(); | |
| 50 | -if (PEAR::isError($root)) | |
| 51 | -{ | |
| 52 | - print $root->getMessage(); | |
| 53 | - exit; | |
| 54 | -} | |
| 55 | - | |
| 56 | -$folder = $root->add_folder('test folder'); | |
| 57 | -if (PEAR::isError($folder)) | |
| 58 | -{ | |
| 59 | - print $folder->getMessage(); | |
| 60 | - exit; | |
| 61 | -} | |
| 62 | - | |
| 63 | -$subfolder = $folder->add_folder('test sub folder'); | |
| 64 | -if (PEAR::isError($subfolder)) | |
| 65 | -{ | |
| 66 | - print $subfolder->getMessage(); | |
| 67 | - exit; | |
| 68 | -} | |
| 69 | - | |
| 70 | -?> |
ktwsapi/php/examples/ktws_eg_doc_info.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * Demonstrates using an active session and getting document info and metadata. | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -// change session to something that is in table 'active_sessions' | |
| 41 | - | |
| 42 | -$response = $ktapi->active_session('sj5827sohdoj6h3nvifrcsa1f2'); | |
| 43 | -if (PEAR::isError($response)) | |
| 44 | -{ | |
| 45 | - print $response->getMessage(); | |
| 46 | - exit; | |
| 47 | -} | |
| 48 | - | |
| 49 | -// lets ge the document based on id. | |
| 50 | - | |
| 51 | -$document = $ktapi->get_document_by_id(50); | |
| 52 | -if (PEAR::isError($document)) | |
| 53 | -{ | |
| 54 | - print $document->getMessage(); | |
| 55 | - exit; | |
| 56 | -} | |
| 57 | - | |
| 58 | -// lets get the document metadata | |
| 59 | - | |
| 60 | -$metadata = $document->get_metadata(); | |
| 61 | -if (PEAR::isError($metadata)) | |
| 62 | -{ | |
| 63 | - print $metadata->getMessage(); | |
| 64 | - exit; | |
| 65 | -} | |
| 66 | -var_dump($metadata); | |
| 67 | - | |
| 68 | -?> |
ktwsapi/php/examples/ktws_eg_folder_listing.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * Demonstrates document checkout and checkin | |
| 34 | - */ | |
| 35 | - | |
| 36 | -require_once('../ktwsapi.inc.php'); | |
| 37 | - | |
| 38 | -$ktapi = new KTWSAPI(KTWebService_WSDL); | |
| 39 | - | |
| 40 | -// change session to something that is in table 'active_sessions' | |
| 41 | - | |
| 42 | -$response = $ktapi->active_session('sj5827sohdoj6h3nvifrcsa1f2'); | |
| 43 | -if (PEAR::isError($response)) | |
| 44 | -{ | |
| 45 | - print $response->getMessage(); | |
| 46 | - exit; | |
| 47 | -} | |
| 48 | - | |
| 49 | -$root = $ktapi->get_root_folder(); | |
| 50 | -if (PEAR::isError($root)) | |
| 51 | -{ | |
| 52 | - print $root->getMessage(); | |
| 53 | - exit; | |
| 54 | -} | |
| 55 | - | |
| 56 | -$listing = $root->get_listing(); | |
| 57 | -if (PEAR::isError($listing)) | |
| 58 | -{ | |
| 59 | - print $listing->getMessage(); | |
| 60 | - exit; | |
| 61 | -} | |
| 62 | - | |
| 63 | -// lets display the items | |
| 64 | - | |
| 65 | -foreach($listing as $folderitem) | |
| 66 | -{ | |
| 67 | - $title = $folderitem->title; | |
| 68 | - $item_type = $folderitem->item_type; | |
| 69 | - $mime_display = $folderitem->mime_display; | |
| 70 | - | |
| 71 | - print "$title $item_type $mime_display\n"; | |
| 72 | -} | |
| 73 | - | |
| 74 | -?> |
ktwsapi/php/ktwsapi.inc.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * This is the object model for the KnowledgeTree WebService. | |
| 34 | - */ | |
| 35 | - | |
| 36 | -// TODO: add more validation based on information already returned. this can prevent all validation being done server side and minimise a little traffic possibly... | |
| 37 | -// TODO: caching so that requests don't have to be returned. | |
| 38 | -// TODO: possibly add a subscriber model, where updates can be propogated through to a cache/model on the client side. | |
| 39 | - | |
| 40 | -require_once('ktwsapi_cfg.inc.php'); | |
| 41 | - | |
| 42 | -ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . KT_PEAR_DIR); | |
| 43 | - | |
| 44 | -require_once('SOAP/Client.php'); | |
| 45 | - | |
| 46 | -define('KTWSAPI_ERR_SESSION_IN_USE','There is a session already active.'); | |
| 47 | -define('KTWSAPI_ERR_SESSION_NOT_STARTED','An active session has not been started.'); | |
| 48 | - | |
| 49 | -class KTWSAPI_FolderItem | |
| 50 | -{ | |
| 51 | - var $ktapi; | |
| 52 | - | |
| 53 | - var $parent_id; | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Upload a file to KT. Returns a temp filename on the server. | |
| 57 | - * | |
| 58 | - * @param string $filename | |
| 59 | - * @param string $action | |
| 60 | - * @param int $document_id | |
| 61 | - * @return string | |
| 62 | - */ | |
| 63 | - function _upload_file($filename, $action, $document_id=null) | |
| 64 | - { | |
| 65 | - if (!extension_loaded('curl')) | |
| 66 | - { | |
| 67 | - return new PEAR_Error('CURL library not included.'); | |
| 68 | - } | |
| 69 | - | |
| 70 | - if (!is_file($filename) || !is_readable($filename)) | |
| 71 | - { | |
| 72 | - return new PEAR_Error('Could not access file to upload.'); | |
| 73 | - } | |
| 74 | - | |
| 75 | - if (is_null($document_id)) | |
| 76 | - { | |
| 77 | - $uploadname="upload_document"; | |
| 78 | - } | |
| 79 | - else | |
| 80 | - { | |
| 81 | - $uploadname="upload_$document_id"; | |
| 82 | - | |
| 83 | - } | |
| 84 | - | |
| 85 | - $session_id = $this->ktapi->session; | |
| 86 | - | |
| 87 | - $ch = curl_init(); | |
| 88 | - $fp = fopen ($filename, 'r'); | |
| 89 | - curl_setopt($ch, CURLOPT_URL, KTUploadURL); | |
| 90 | - curl_setopt($ch, CURLOPT_POST, 1); | |
| 91 | - | |
| 92 | - $post_fields = array( | |
| 93 | - 'session_id'=>$session_id, | |
| 94 | - 'action'=>$action, | |
| 95 | - 'document_id'=>$document_id, | |
| 96 | - $uploadname=>'@' . $filename | |
| 97 | - | |
| 98 | - ); | |
| 99 | - | |
| 100 | - $str = serialize($post_fields); | |
| 101 | - | |
| 102 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); | |
| 103 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); | |
| 104 | - $response = curl_exec ($ch); | |
| 105 | - curl_close ($ch); | |
| 106 | - | |
| 107 | - if ($response == '') | |
| 108 | - { | |
| 109 | - return new PEAR_Error('No response from server.'); | |
| 110 | - } | |
| 111 | - | |
| 112 | - $fields=explode('&',$response); | |
| 113 | - $status_code=-1; | |
| 114 | - $msg='*not set*'; | |
| 115 | - $upload_status=''; | |
| 116 | - | |
| 117 | - | |
| 118 | - foreach($fields as $field) | |
| 119 | - { | |
| 120 | - list($fieldname, $value) = explode('=', $field); | |
| 121 | - | |
| 122 | - $$fieldname = $value; | |
| 123 | - } | |
| 124 | - | |
| 125 | - if ($status_code == 0) | |
| 126 | - { | |
| 127 | - $upload_status= unserialize(urldecode($upload_status)); | |
| 128 | - | |
| 129 | - if ($upload_status[$uploadname]['size'] == filesize($filename)) | |
| 130 | - { | |
| 131 | - return $upload_status[$uploadname]['tmp_name']; | |
| 132 | - } | |
| 133 | - } | |
| 134 | - return new PEAR_Error('Could not upload file.'); | |
| 135 | - | |
| 136 | - } | |
| 137 | - | |
| 138 | - /** | |
| 139 | - * Downlaods a file from KT. | |
| 140 | - * | |
| 141 | - * @param string $url | |
| 142 | - * @param string $localpath | |
| 143 | - * @param string $filename | |
| 144 | - * @return boolean | |
| 145 | - */ | |
| 146 | - function _download_file($url, $localpath, $filename) | |
| 147 | - { | |
| 148 | - $localfilename = $localpath . '/' . $filename; | |
| 149 | - | |
| 150 | - $fp = fopen($localfilename,'wb'); | |
| 151 | - if ($fp == null) | |
| 152 | - { | |
| 153 | - return new PEAR_Error('Could not create local file'); | |
| 154 | - } | |
| 155 | - | |
| 156 | - $ch = curl_init(); | |
| 157 | - | |
| 158 | - curl_setopt($ch, CURLOPT_FILE, $fp); | |
| 159 | - curl_setopt($ch, CURLOPT_HEADER, 0); | |
| 160 | - curl_setopt($ch, CURLOPT_URL, $url); | |
| 161 | - | |
| 162 | - $response = curl_exec($ch); | |
| 163 | - if ($response == false) | |
| 164 | - { | |
| 165 | - $response = new PEAR_Error(curl_error($ch)); | |
| 166 | - } | |
| 167 | - else | |
| 168 | - { | |
| 169 | - $response = true; | |
| 170 | - } | |
| 171 | - curl_close($ch); | |
| 172 | - | |
| 173 | - fclose($fp); | |
| 174 | - | |
| 175 | - return $response; | |
| 176 | - } | |
| 177 | - | |
| 178 | - /** | |
| 179 | - * Returns a reference to the parent folder. | |
| 180 | - * | |
| 181 | - * @return KTWSAPI_Folder | |
| 182 | - */ | |
| 183 | - function &get_parent_folder() | |
| 184 | - { | |
| 185 | - $parent = &KTAPI::get_folder_by_id($this->parent_id); | |
| 186 | - return $parent; | |
| 187 | - } | |
| 188 | - | |
| 189 | -} | |
| 190 | - | |
| 191 | -class KTWSAPI_Folder extends KTWSAPI_FolderItem | |
| 192 | -{ | |
| 193 | - var $folder_name; | |
| 194 | - var $full_path; | |
| 195 | - var $folder_id; | |
| 196 | - | |
| 197 | - /** | |
| 198 | - * Constructor | |
| 199 | - * | |
| 200 | - * @param KTWSAPI $ktapi | |
| 201 | - * @param kt_folder_detail $kt_folder_detail | |
| 202 | - * @return KTWSAPI_Folder | |
| 203 | - */ | |
| 204 | - function KTWSAPI_Folder(&$ktapi, $kt_folder_detail) | |
| 205 | - { | |
| 206 | - $this->ktapi = &$ktapi; | |
| 207 | - $this->folder_id = $kt_folder_detail->id+0; | |
| 208 | - $this->folder_name = $kt_folder_detail->folder_name; | |
| 209 | - $this->parent_id = $kt_folder_detail->parent_id+0; | |
| 210 | - $this->full_path = $kt_folder_detail->full_path; | |
| 211 | - } | |
| 212 | - | |
| 213 | - /** | |
| 214 | - * Returns a reference to a KTWSAPI_Folder | |
| 215 | - * | |
| 216 | - * @param KTWSAPI $ktapi | |
| 217 | - * @param int $folderid | |
| 218 | - * @return KTWSAPI_Folder | |
| 219 | - */ | |
| 220 | - function &get(&$ktapi, $folderid) | |
| 221 | - { | |
| 222 | - assert(!is_null($ktapi)); | |
| 223 | - assert(is_a($ktapi, 'KTWSAPI')); | |
| 224 | - assert(is_numeric($folderid)); | |
| 225 | - | |
| 226 | - $folderid += 0; | |
| 227 | - | |
| 228 | - $kt_folder_detail = $ktapi->soapclient->get_folder_detail($ktapi->session, $folderid); | |
| 229 | - if (SOAP_Client::isError($kt_folder_detail)) | |
| 230 | - { | |
| 231 | - return $kt_folder_detail; | |
| 232 | - } | |
| 233 | - | |
| 234 | - if ($kt_folder_detail->status_code != 0) | |
| 235 | - { | |
| 236 | - return new PEAR_Error($kt_folder_detail->message); | |
| 237 | - } | |
| 238 | - | |
| 239 | - $folder = & new KTWSAPI_Folder($ktapi, $kt_folder_detail); | |
| 240 | - | |
| 241 | - return $folder; | |
| 242 | - } | |
| 243 | - | |
| 244 | - /** | |
| 245 | - * Returnss the parent folder id. | |
| 246 | - * | |
| 247 | - * @return int | |
| 248 | - */ | |
| 249 | - function get_parent_folder_id() | |
| 250 | - { | |
| 251 | - return $this->parent_id; | |
| 252 | - } | |
| 253 | - | |
| 254 | - /** | |
| 255 | - * Returns the folder name. | |
| 256 | - * | |
| 257 | - * @return string | |
| 258 | - */ | |
| 259 | - function get_folder_name() | |
| 260 | - { | |
| 261 | - return $this->folder_name; | |
| 262 | - } | |
| 263 | - | |
| 264 | - /** | |
| 265 | - * Returns the current folder id. | |
| 266 | - * | |
| 267 | - * @return int | |
| 268 | - */ | |
| 269 | - function get_folderid() | |
| 270 | - { | |
| 271 | - return $this->folder_id; | |
| 272 | - } | |
| 273 | - | |
| 274 | - /** | |
| 275 | - * Returns the foldre based on foldername. | |
| 276 | - * | |
| 277 | - * @param string $foldername | |
| 278 | - * @return KTWSAPI_Folder | |
| 279 | - */ | |
| 280 | - function &get_folder_by_name($foldername) | |
| 281 | - { | |
| 282 | - $path = $this->full_path . '/' . $foldername; | |
| 283 | - if (substr($path,0,13) == '/Root Folder/') | |
| 284 | - { | |
| 285 | - $path = substr($path,13); | |
| 286 | - } | |
| 287 | - if (substr($path,0,12) == 'Root Folder/') | |
| 288 | - { | |
| 289 | - $path = substr($path,12); | |
| 290 | - } | |
| 291 | - | |
| 292 | - $kt_folder_detail = $this->ktapi->soapclient->get_folder_detail_by_name($this->ktapi->session, $path); | |
| 293 | - | |
| 294 | - if (SOAP_Client::isError($kt_folder_detail)) | |
| 295 | - { | |
| 296 | - return $kt_folder_detail; | |
| 297 | - } | |
| 298 | - | |
| 299 | - if ($kt_folder_detail->status_code != 0) | |
| 300 | - { | |
| 301 | - return new PEAR_Error($kt_folder_detail->message); | |
| 302 | - } | |
| 303 | - | |
| 304 | - $folder= & new KTWSAPI_Folder($this->ktapi, $kt_folder_detail); | |
| 305 | - return $folder; | |
| 306 | - } | |
| 307 | - | |
| 308 | - /** | |
| 309 | - * Returns the full folder path. | |
| 310 | - * | |
| 311 | - * @return string | |
| 312 | - */ | |
| 313 | - function get_full_path() | |
| 314 | - { | |
| 315 | - return $this->full_path; | |
| 316 | - } | |
| 317 | - | |
| 318 | - /** | |
| 319 | - * Returns the contents of a folder. | |
| 320 | - * | |
| 321 | - * @param int $depth | |
| 322 | - * @param string $what | |
| 323 | - * @return kt_folder_items | |
| 324 | - */ | |
| 325 | - function get_listing($depth=1, $what='DF') | |
| 326 | - { | |
| 327 | - $kt_folder_contents = $this->ktapi->soapclient->get_folder_contents($this->ktapi->session, $this->folder_id, $depth+0, $what); | |
| 328 | - if (SOAP_Client::isError($kt_folder_contents)) | |
| 329 | - { | |
| 330 | - return $kt_folder_contents; | |
| 331 | - } | |
| 332 | - | |
| 333 | - if ($kt_folder_contents->status_code != 0) | |
| 334 | - { | |
| 335 | - return new PEAR_Error($kt_folder_contents->message); | |
| 336 | - } | |
| 337 | - | |
| 338 | - return $kt_folder_contents->items; | |
| 339 | - } | |
| 340 | - | |
| 341 | - /** | |
| 342 | - * Returns a document based on title. | |
| 343 | - * | |
| 344 | - * @param string $title | |
| 345 | - * @return KTWSAPI_Document | |
| 346 | - */ | |
| 347 | - function &get_document_by_name($title) | |
| 348 | - { | |
| 349 | - $path = $this->full_path . '/' . $title; | |
| 350 | - if (substr($path,0,13) == '/Root Folder/') | |
| 351 | - { | |
| 352 | - $path = substr($path,13); | |
| 353 | - } | |
| 354 | - if (substr($path,0,12) == 'Root Folder/') | |
| 355 | - { | |
| 356 | - $path = substr($path,12); | |
| 357 | - } | |
| 358 | - | |
| 359 | - $kt_document_detail = $this->ktapi->soapclient->get_document_detail_by_name($this->ktapi->session, $path, 'T'); | |
| 360 | - | |
| 361 | - if (SOAP_Client::isError($kt_document_detail)) | |
| 362 | - { | |
| 363 | - return $kt_document_detail; | |
| 364 | - } | |
| 365 | - | |
| 366 | - if ($kt_document_detail->status_code != 0) | |
| 367 | - { | |
| 368 | - return new PEAR_Error($kt_document_detail->message); | |
| 369 | - } | |
| 370 | - | |
| 371 | - $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail); | |
| 372 | - | |
| 373 | - return $document; | |
| 374 | - } | |
| 375 | - | |
| 376 | - /** | |
| 377 | - * Returns a document based on filename. | |
| 378 | - * | |
| 379 | - * @param string $filename | |
| 380 | - * @return KTWSAPI_Document | |
| 381 | - */ | |
| 382 | - function &get_document_by_filename($filename) | |
| 383 | - { | |
| 384 | - $path = $this->full_path . '/' . $filename; | |
| 385 | - if (substr($path,0,13) == '/Root Folder/') | |
| 386 | - { | |
| 387 | - $path = substr($path,13); | |
| 388 | - } | |
| 389 | - if (substr($path,0,12) == 'Root Folder/') | |
| 390 | - { | |
| 391 | - $path = substr($path,12); | |
| 392 | - } | |
| 393 | - | |
| 394 | - $kt_document_detail = $this->ktapi->soapclient->get_document_detail_by_name($this->ktapi->session, $path, 'F'); | |
| 395 | - | |
| 396 | - if (SOAP_Client::isError($kt_document_detail)) | |
| 397 | - { | |
| 398 | - return $kt_document_detail; | |
| 399 | - } | |
| 400 | - | |
| 401 | - if ($kt_document_detail->status_code != 0) | |
| 402 | - { | |
| 403 | - return new PEAR_Error($kt_document_detail->message); | |
| 404 | - } | |
| 405 | - | |
| 406 | - $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail); | |
| 407 | - return $document; | |
| 408 | - } | |
| 409 | - | |
| 410 | - | |
| 411 | - /** | |
| 412 | - * Adds a sub folder. | |
| 413 | - * | |
| 414 | - * @param string $foldername | |
| 415 | - * @return KTWSAPI_Folder | |
| 416 | - */ | |
| 417 | - function &add_folder($foldername) | |
| 418 | - { | |
| 419 | - $kt_folder_detail = $this->ktapi->soapclient->create_folder($this->ktapi->session, $this->folder_id, $foldername); | |
| 420 | - if (SOAP_Client::isError($kt_folder_detail)) | |
| 421 | - { | |
| 422 | - return $kt_folder_detail; | |
| 423 | - } | |
| 424 | - | |
| 425 | - if ($kt_folder_detail->status_code != 0) | |
| 426 | - { | |
| 427 | - return new PEAR_Error($kt_folder_detail->message); | |
| 428 | - } | |
| 429 | - | |
| 430 | - $folder = &new KTWSAPI_Folder($this->ktapi, $kt_folder_detail); | |
| 431 | - | |
| 432 | - return $folder; | |
| 433 | - } | |
| 434 | - | |
| 435 | - /** | |
| 436 | - * Deletes the current folder. | |
| 437 | - * | |
| 438 | - * @param string $reason | |
| 439 | - * @return true | |
| 440 | - */ | |
| 441 | - function delete($reason) | |
| 442 | - { | |
| 443 | - // TODO: check why no transaction in folder_transactions | |
| 444 | - $kt_response = $this->ktapi->soapclient->delete_folder($this->ktapi->session, $this->folder_id, $reason); | |
| 445 | - if (SOAP_Client::isError($kt_response)) | |
| 446 | - { | |
| 447 | - return $kt_response; | |
| 448 | - } | |
| 449 | - | |
| 450 | - if ($kt_response->status_code != 0) | |
| 451 | - { | |
| 452 | - return new PEAR_Error($kt_response->message); | |
| 453 | - } | |
| 454 | - | |
| 455 | - return true; | |
| 456 | - } | |
| 457 | - | |
| 458 | - /** | |
| 459 | - * Renames the current folder. | |
| 460 | - * | |
| 461 | - * @param string $newname | |
| 462 | - * @return true | |
| 463 | - */ | |
| 464 | - function rename($newname) | |
| 465 | - { | |
| 466 | - $kt_response = $this->ktapi->soapclient->rename_folder($this->ktapi->session, $this->folder_id, $newname); | |
| 467 | - if (SOAP_Client::isError($kt_response)) | |
| 468 | - { | |
| 469 | - return $kt_response; | |
| 470 | - } | |
| 471 | - | |
| 472 | - if ($kt_response->status_code != 0) | |
| 473 | - { | |
| 474 | - return new PEAR_Error($kt_response->message); | |
| 475 | - } | |
| 476 | - | |
| 477 | - return true; | |
| 478 | - } | |
| 479 | - | |
| 480 | - /** | |
| 481 | - * Moves a folder to another location. | |
| 482 | - * | |
| 483 | - * @param KTWSAPI_Folder $ktwsapi_target_folder | |
| 484 | - * @param string $reason | |
| 485 | - * @return true | |
| 486 | - */ | |
| 487 | - function move(&$ktwsapi_target_folder, $reason='') | |
| 488 | - { | |
| 489 | - assert(!is_null($ktwsapi_target_folder)); | |
| 490 | - assert(is_a($ktwsapi_target_folder,'KTWSAPI_Folder')); | |
| 491 | - | |
| 492 | - $kt_response = $this->ktapi->soapclient->move_folder($this->ktapi->session, $this->folder_id,$ktwsapi_target_folder->get_folderid()); | |
| 493 | - if (SOAP_Client::isError($kt_response)) | |
| 494 | - { | |
| 495 | - return $kt_response; | |
| 496 | - } | |
| 497 | - | |
| 498 | - if ($kt_response->status_code != 0) | |
| 499 | - { | |
| 500 | - return new PEAR_Error($kt_response->message); | |
| 501 | - } | |
| 502 | - | |
| 503 | - return true; | |
| 504 | - } | |
| 505 | - | |
| 506 | - /** | |
| 507 | - * Copies a folder to another location | |
| 508 | - * | |
| 509 | - * @param KTWSAPI_Folder $ktwsapi_target_folder | |
| 510 | - * @param string $reason | |
| 511 | - * @return true | |
| 512 | - */ | |
| 513 | - function copy(&$ktwsapi_target_folder, $reason='') | |
| 514 | - { | |
| 515 | - assert(!is_null($ktwsapi_target_folder)); | |
| 516 | - assert(is_a($ktwsapi_target_folder,'KTWSAPI_Folder')); | |
| 517 | - | |
| 518 | - $targetid=$ktwsapi_target_folder->get_folderid(); | |
| 519 | - | |
| 520 | - $kt_response = $this->ktapi->soapclient->copy_folder($this->ktapi->session, $this->folder_id,$targetid, $reason); | |
| 521 | - if (SOAP_Client::isError($kt_response)) | |
| 522 | - { | |
| 523 | - return $kt_response; | |
| 524 | - } | |
| 525 | - | |
| 526 | - if ($kt_response->status_code != 0) | |
| 527 | - { | |
| 528 | - return new PEAR_Error($kt_response->message); | |
| 529 | - } | |
| 530 | - | |
| 531 | - return true; | |
| 532 | - } | |
| 533 | - | |
| 534 | - /** | |
| 535 | - * Adds a document to the current folder. | |
| 536 | - * | |
| 537 | - * @param string $filename | |
| 538 | - * @param string $title | |
| 539 | - * @param string $documenttype | |
| 540 | - * @return KTWSAPI_Document | |
| 541 | - */ | |
| 542 | - function &add_document($filename, $title=null, $documenttype=null) | |
| 543 | - { | |
| 544 | - if (empty($title)) | |
| 545 | - { | |
| 546 | - $title=basename($filename); | |
| 547 | - } | |
| 548 | - $basename=basename($filename); | |
| 549 | - | |
| 550 | - if (empty($documenttype)) | |
| 551 | - { | |
| 552 | - $documenttype='Default'; | |
| 553 | - } | |
| 554 | - | |
| 555 | - // First step - upload file | |
| 556 | - $tempfilename = $this->_upload_file($filename,'A'); | |
| 557 | - if (PEAR::isError($tempfilename)) | |
| 558 | - { | |
| 559 | - return new PEAR_Error($tempfilename->message); | |
| 560 | - } | |
| 561 | - | |
| 562 | - // Second step - move file into KT | |
| 563 | - $kt_document_detail = $this->ktapi->soapclient->add_document($this->ktapi->session, $this->folder_id, $title, $basename, $documenttype, $tempfilename ); | |
| 564 | - if (SOAP_Client::isError($kt_document_detail)) | |
| 565 | - { | |
| 566 | - return $kt_document_detail; | |
| 567 | - } | |
| 568 | - | |
| 569 | - if ($kt_document_detail->status_code != 0) | |
| 570 | - { | |
| 571 | - return new PEAR_Error($kt_document_detail->message); | |
| 572 | - } | |
| 573 | - | |
| 574 | - $document = & new KTWSAPI_Document($this->ktapi, $kt_document_detail); | |
| 575 | - return $document; | |
| 576 | - } | |
| 577 | -} | |
| 578 | - | |
| 579 | -class KTWSAPI_Document extends KTWSAPI_FolderItem | |
| 580 | -{ | |
| 581 | - var $document_id; | |
| 582 | - var $title; | |
| 583 | - var $document_type; | |
| 584 | - var $version; | |
| 585 | - var $filename; | |
| 586 | - var $created_date; | |
| 587 | - var $created_by; | |
| 588 | - var $updated_date; | |
| 589 | - var $updated_by; | |
| 590 | - var $workflow; | |
| 591 | - var $workflow_state; | |
| 592 | - var $checkout_by; | |
| 593 | - var $full_path; | |
| 594 | - | |
| 595 | - /** | |
| 596 | - * Constructor | |
| 597 | - * | |
| 598 | - * @param KTWSAPI $ktapi | |
| 599 | - * @param kt_document_detail $kt_document_detail | |
| 600 | - * @return KTWSAPI_Document | |
| 601 | - */ | |
| 602 | - function KTWSAPI_Document(&$ktapi, $kt_document_detail) | |
| 603 | - { | |
| 604 | - $this->ktapi=&$ktapi; | |
| 605 | - $this->document_id = $kt_document_detail->document_id; | |
| 606 | - $this->title = $kt_document_detail->title; | |
| 607 | - $this->document_type = $kt_document_detail->document_type; | |
| 608 | - $this->version = $kt_document_detail->version; | |
| 609 | - $this->filename = $kt_document_detail->filename; | |
| 610 | - $this->created_date = $kt_document_detail->created_date; | |
| 611 | - $this->created_by = $kt_document_detail->created_by; | |
| 612 | - $this->updated_date = $kt_document_detail->updated_date; | |
| 613 | - $this->updated_by = $kt_document_detail->updated_by; | |
| 614 | - $this->parent_id = $kt_document_detail->folder_id; | |
| 615 | - $this->workflow = $kt_document_detail->workflow; | |
| 616 | - $this->workflow_state = $kt_document_detail->workflow_state; | |
| 617 | - $this->checkout_by = $kt_document_detail->checkout_by; | |
| 618 | - $this->full_path = $kt_document_detail->full_path; | |
| 619 | - } | |
| 620 | - | |
| 621 | - /** | |
| 622 | - * Returns a reference to a document. | |
| 623 | - * | |
| 624 | - * @param KTWSAPI $ktapi | |
| 625 | - * @param int $documentid | |
| 626 | - * @param boolean $loadinfo | |
| 627 | - * @return KTWSAPI_Document | |
| 628 | - */ | |
| 629 | - function &get(&$ktapi, $documentid, $loadinfo=true) | |
| 630 | - { | |
| 631 | - assert(!is_null($ktapi)); | |
| 632 | - assert(is_a($ktapi, 'KTWSAPI')); | |
| 633 | - assert(is_numeric($documentid)); | |
| 634 | - | |
| 635 | - if ($loadinfo) | |
| 636 | - { | |
| 637 | - $kt_document_detail = $ktapi->soapclient->get_document_detail($ktapi->session, $documentid); | |
| 638 | - if (SOAP_Client::isError($kt_document_detail)) | |
| 639 | - { | |
| 640 | - return $kt_document_detail; | |
| 641 | - } | |
| 642 | - | |
| 643 | - if ($kt_document_detail->status_code != 0) | |
| 644 | - { | |
| 645 | - return new PEAR_Error($kt_document_detail->message); | |
| 646 | - } | |
| 647 | - } | |
| 648 | - else | |
| 649 | - { | |
| 650 | - $kt_document_detail = array( | |
| 651 | - 'document_id'=>$documentid, | |
| 652 | - ); | |
| 653 | - } | |
| 654 | - | |
| 655 | - $document=& new KTWSAPI_Document($ktapi, $kt_document_detail); | |
| 656 | - return $document; | |
| 657 | - } | |
| 658 | - | |
| 659 | - /** | |
| 660 | - * Checks in a document. | |
| 661 | - * | |
| 662 | - * @param string $filename | |
| 663 | - * @param string $reason | |
| 664 | - * @param boolean $major_update | |
| 665 | - * @return true | |
| 666 | - */ | |
| 667 | - function checkin($filename, $reason, $major_update ) | |
| 668 | - { | |
| 669 | - $basename=basename($filename); | |
| 670 | - | |
| 671 | - $tempfilename = $this->_upload_file($filename,'C', $this->document_id); | |
| 672 | - if (PEAR::isError($tempfilename)) | |
| 673 | - { | |
| 674 | - return new PEAR_Error($tempfilename->message); | |
| 675 | - } | |
| 676 | - | |
| 677 | - $kt_response = $this->ktapi->soapclient->checkin_document($this->ktapi->session, $this->document_id, $basename, $reason, $tempfilename, $major_update ); | |
| 678 | - if (SOAP_Client::isError($kt_response)) | |
| 679 | - { | |
| 680 | - return $kt_response; | |
| 681 | - } | |
| 682 | - | |
| 683 | - if ($kt_response->status_code != 0) | |
| 684 | - { | |
| 685 | - return new PEAR_Error($kt_response->message); | |
| 686 | - } | |
| 687 | - | |
| 688 | - return true; | |
| 689 | - } | |
| 690 | - | |
| 691 | - /** | |
| 692 | - * Checks out a document. | |
| 693 | - * | |
| 694 | - * @param string $reason | |
| 695 | - * @param string $localpath | |
| 696 | - * @return true | |
| 697 | - */ | |
| 698 | - function checkout($reason, $localpath=null) | |
| 699 | - { | |
| 700 | - if (is_null($localpath)) | |
| 701 | - { | |
| 702 | - $localpath = $this->ktapi->get_download_path(); | |
| 703 | - } | |
| 704 | - | |
| 705 | - if (!is_dir($localpath)) | |
| 706 | - { | |
| 707 | - return new PEAR_Error('local path does not exist'); | |
| 708 | - } | |
| 709 | - if (!is_writable($localpath)) | |
| 710 | - { | |
| 711 | - return new PEAR_Error('local path is not writable'); | |
| 712 | - } | |
| 713 | - | |
| 714 | - $kt_response = $this->ktapi->soapclient->checkout_document($this->ktapi->session, $this->document_id, $reason); | |
| 715 | - if (SOAP_Client::isError($kt_response)) | |
| 716 | - { | |
| 717 | - return $kt_response; | |
| 718 | - } | |
| 719 | - | |
| 720 | - if ($kt_response->status_code != 0) | |
| 721 | - { | |
| 722 | - return new PEAR_Error($kt_response->message); | |
| 723 | - } | |
| 724 | - | |
| 725 | - $url = $kt_response->message; | |
| 726 | - | |
| 727 | - $response = $this->_download_file($url, $localpath, $this->filename); | |
| 728 | - if (PEAR::isError($response)) | |
| 729 | - { | |
| 730 | - return new PEAR_Error($kt_response->message); | |
| 731 | - } | |
| 732 | - | |
| 733 | - return true; | |
| 734 | - } | |
| 735 | - | |
| 736 | - /** | |
| 737 | - * Undo a document checkout | |
| 738 | - * | |
| 739 | - * @param string $reason | |
| 740 | - * @return true | |
| 741 | - */ | |
| 742 | - function undo_checkout($reason) | |
| 743 | - { | |
| 744 | - $kt_response = $this->ktapi->soapclient->undo_document_checkout($this->ktapi->session, $this->document_id, $reason); | |
| 745 | - if (SOAP_Client::isError($kt_response)) | |
| 746 | - { | |
| 747 | - return $kt_response; | |
| 748 | - } | |
| 749 | - | |
| 750 | - if ($kt_response->status_code != 0) | |
| 751 | - { | |
| 752 | - return new PEAR_Error($kt_response->message); | |
| 753 | - } | |
| 754 | - | |
| 755 | - return true; | |
| 756 | - } | |
| 757 | - | |
| 758 | - /** | |
| 759 | - * Download a version of the document | |
| 760 | - * | |
| 761 | - * @param string $version | |
| 762 | - * @param string $localpath | |
| 763 | - * @return true | |
| 764 | - */ | |
| 765 | - function download($version=null, $localpath=null) | |
| 766 | - { | |
| 767 | - if (is_null($localpath)) | |
| 768 | - { | |
| 769 | - $localpath = $this->ktapi->get_download_path(); | |
| 770 | - } | |
| 771 | - | |
| 772 | - if (!is_dir($localpath)) | |
| 773 | - { | |
| 774 | - return new PEAR_Error('local path does not exist'); | |
| 775 | - } | |
| 776 | - if (!is_writable($localpath)) | |
| 777 | - { | |
| 778 | - return new PEAR_Error('local path is not writable'); | |
| 779 | - } | |
| 780 | - | |
| 781 | - $kt_response = $this->ktapi->soapclient->download_document($this->ktapi->session, $this->document_id); | |
| 782 | - if (SOAP_Client::isError($kt_response)) | |
| 783 | - { | |
| 784 | - return $kt_response; | |
| 785 | - } | |
| 786 | - | |
| 787 | - if ($kt_response->status_code != 0) | |
| 788 | - { | |
| 789 | - return new PEAR_Error($kt_response->message); | |
| 790 | - } | |
| 791 | - | |
| 792 | - $url = $kt_response->message; | |
| 793 | - | |
| 794 | - $response = $this->_download_file($url, $localpath, $this->filename); | |
| 795 | - if (PEAR::isError($response)) | |
| 796 | - { | |
| 797 | - return new PEAR_Error($kt_response->message); | |
| 798 | - } | |
| 799 | - | |
| 800 | - return true; | |
| 801 | - } | |
| 802 | - | |
| 803 | - /** | |
| 804 | - * Deletes the current document. | |
| 805 | - * | |
| 806 | - * @param string $reason | |
| 807 | - * @return true | |
| 808 | - */ | |
| 809 | - function delete($reason) | |
| 810 | - { | |
| 811 | - $kt_response = $this->ktapi->soapclient->delete_document($this->ktapi->session, $this->document_id, $reason); | |
| 812 | - if (SOAP_Client::isError($kt_response)) | |
| 813 | - { | |
| 814 | - return $kt_response; | |
| 815 | - } | |
| 816 | - | |
| 817 | - if ($kt_response->status_code != 0) | |
| 818 | - { | |
| 819 | - return new PEAR_Error($kt_response->message); | |
| 820 | - } | |
| 821 | - | |
| 822 | - return true; | |
| 823 | - } | |
| 824 | - | |
| 825 | - /** | |
| 826 | - * Changes the owner of the document. | |
| 827 | - * | |
| 828 | - * @param string $username | |
| 829 | - * @param string $reason | |
| 830 | - * @return true | |
| 831 | - */ | |
| 832 | - function change_owner($username, $reason) | |
| 833 | - { | |
| 834 | - $kt_response = $this->ktapi->soapclient->change_document_owner($this->ktapi->session, $this->document_id, $username, $reason); | |
| 835 | - if (SOAP_Client::isError($kt_response)) | |
| 836 | - { | |
| 837 | - return $kt_response; | |
| 838 | - } | |
| 839 | - | |
| 840 | - if ($kt_response->status_code != 0) | |
| 841 | - { | |
| 842 | - return new PEAR_Error($kt_response->message); | |
| 843 | - } | |
| 844 | - | |
| 845 | - return true; | |
| 846 | - } | |
| 847 | - | |
| 848 | - /** | |
| 849 | - * Copies the document to the specified folder. | |
| 850 | - * | |
| 851 | - * @param KTWSAPI_Folder $folder | |
| 852 | - * @param string $reason | |
| 853 | - * @param string $newtitle | |
| 854 | - * @param string $newfilename | |
| 855 | - */ | |
| 856 | - function copy(&$folder,$reason,$newtitle='',$newfilename='') | |
| 857 | - { | |
| 858 | - assert(is_a($folder,'KTWSAPI_Folder')); | |
| 859 | - assert(!is_null($folder)); | |
| 860 | - | |
| 861 | - $folder_id = $folder->folderid; | |
| 862 | - $kt_response = $this->ktapi->soapclient->copy_document($this->ktapi->session, $this->document_id, $folder_id, $reason, $newtitle, $newfilename); | |
| 863 | - if (SOAP_Client::isError($kt_response)) | |
| 864 | - { | |
| 865 | - return $kt_response; | |
| 866 | - } | |
| 867 | - | |
| 868 | - if ($kt_response->status_code != 0) | |
| 869 | - { | |
| 870 | - return new PEAR_Error($kt_response->message); | |
| 871 | - } | |
| 872 | - | |
| 873 | - return true; | |
| 874 | - } | |
| 875 | - | |
| 876 | - /** | |
| 877 | - * Moves the current folder to the specified folder. | |
| 878 | - * | |
| 879 | - * @param KTWSAPI_Folder $folder | |
| 880 | - * @param string $reason | |
| 881 | - * @param string $newtitle | |
| 882 | - * @param string $newfilename | |
| 883 | - * @return true | |
| 884 | - */ | |
| 885 | - function move(&$folder,$reason,$newtitle='',$newfilename='') | |
| 886 | - { | |
| 887 | - assert(is_a($folder,'KTWSAPI_Folder')); | |
| 888 | - assert(!is_null($folder)); | |
| 889 | - | |
| 890 | - $folder_id = $folder->folderid; | |
| 891 | - $kt_response = $this->ktapi->soapclient->move_document($this->ktapi->session, $this->document_id, $folder_id, $reason, $newtitle, $newfilename); | |
| 892 | - if (SOAP_Client::isError($kt_response)) | |
| 893 | - { | |
| 894 | - return $kt_response; | |
| 895 | - } | |
| 896 | - | |
| 897 | - if ($kt_response->status_code != 0) | |
| 898 | - { | |
| 899 | - return new PEAR_Error($kt_response->message); | |
| 900 | - } | |
| 901 | - | |
| 902 | - return true; | |
| 903 | - } | |
| 904 | - | |
| 905 | - /** | |
| 906 | - * Changes the document type. | |
| 907 | - * | |
| 908 | - * @param string $documenttype | |
| 909 | - * @return true | |
| 910 | - */ | |
| 911 | - function change_document_type($documenttype) | |
| 912 | - { | |
| 913 | - $kt_response = $this->ktapi->soapclient->change_document_type($this->ktapi->session, $this->document_id, $documenttype); | |
| 914 | - if (SOAP_Client::isError($kt_response)) | |
| 915 | - { | |
| 916 | - return $kt_response; | |
| 917 | - } | |
| 918 | - | |
| 919 | - if ($kt_response->status_code != 0) | |
| 920 | - { | |
| 921 | - return new PEAR_Error($kt_response->message); | |
| 922 | - } | |
| 923 | - | |
| 924 | - return true; | |
| 925 | - } | |
| 926 | - | |
| 927 | - /** | |
| 928 | - * Renames the title of the current document. | |
| 929 | - * | |
| 930 | - * @param string $newtitle | |
| 931 | - * @return true | |
| 932 | - */ | |
| 933 | - function rename_title( $newtitle) | |
| 934 | - { | |
| 935 | - $kt_response = $this->ktapi->soapclient->rename_document_title($this->ktapi->session, $this->document_id, $newtitle); | |
| 936 | - if (SOAP_Client::isError($kt_response)) | |
| 937 | - { | |
| 938 | - return $kt_response; | |
| 939 | - } | |
| 940 | - | |
| 941 | - if ($kt_response->status_code != 0) | |
| 942 | - { | |
| 943 | - return new PEAR_Error($kt_response->message); | |
| 944 | - } | |
| 945 | - | |
| 946 | - return true; | |
| 947 | - } | |
| 948 | - | |
| 949 | - /** | |
| 950 | - * Renames the filename of the current document. | |
| 951 | - * | |
| 952 | - * @param string $newfilename | |
| 953 | - * @return true | |
| 954 | - */ | |
| 955 | - function rename_filename( $newfilename) | |
| 956 | - { | |
| 957 | - $kt_response = $this->ktapi->soapclient->rename_document_filename($this->ktapi->session, $this->document_id, $newfilename); | |
| 958 | - if (SOAP_Client::isError($kt_response)) | |
| 959 | - { | |
| 960 | - return $kt_response; | |
| 961 | - } | |
| 962 | - | |
| 963 | - if ($kt_response->status_code != 0) | |
| 964 | - { | |
| 965 | - return new PEAR_Error($kt_response->message); | |
| 966 | - } | |
| 967 | - | |
| 968 | - return true; | |
| 969 | - } | |
| 970 | - | |
| 971 | - /** | |
| 972 | - * Starts a workflow on the current document. | |
| 973 | - * | |
| 974 | - * @param string $workflow | |
| 975 | - * @return true | |
| 976 | - */ | |
| 977 | - function start_workflow($workflow) | |
| 978 | - { | |
| 979 | - $kt_response = $this->ktapi->soapclient->start_document_workflow($this->ktapi->session, $this->document_id, $workflow); | |
| 980 | - if (SOAP_Client::isError($kt_response)) | |
| 981 | - { | |
| 982 | - return $kt_response; | |
| 983 | - } | |
| 984 | - | |
| 985 | - if ($kt_response->status_code != 0) | |
| 986 | - { | |
| 987 | - return new PEAR_Error($kt_response->message); | |
| 988 | - } | |
| 989 | - | |
| 990 | - return true; | |
| 991 | - } | |
| 992 | - | |
| 993 | - /** | |
| 994 | - * Removes the workflow process from the current document. | |
| 995 | - * | |
| 996 | - * @return true | |
| 997 | - */ | |
| 998 | - function delete_workflow() | |
| 999 | - { | |
| 1000 | - $kt_response = $this->ktapi->soapclient->delete_document_workflow($this->ktapi->session, $this->document_id); | |
| 1001 | - if (SOAP_Client::isError($kt_response)) | |
| 1002 | - { | |
| 1003 | - return $kt_response; | |
| 1004 | - } | |
| 1005 | - | |
| 1006 | - if ($kt_response->status_code != 0) | |
| 1007 | - { | |
| 1008 | - return new PEAR_Error($kt_response->message); | |
| 1009 | - } | |
| 1010 | - | |
| 1011 | - return true; | |
| 1012 | - } | |
| 1013 | - | |
| 1014 | - /** | |
| 1015 | - * Performs a transition on the current document. | |
| 1016 | - * | |
| 1017 | - * @param string $transition | |
| 1018 | - * @param string $reason | |
| 1019 | - * @return true | |
| 1020 | - */ | |
| 1021 | - function perform_workflow_transition($transition,$reason) | |
| 1022 | - { | |
| 1023 | - $kt_response = $this->ktapi->soapclient->perform_workflow_transition($this->ktapi->session, $this->document_id, $transition, $reason); | |
| 1024 | - if (SOAP_Client::isError($kt_response)) | |
| 1025 | - { | |
| 1026 | - return $kt_response; | |
| 1027 | - } | |
| 1028 | - | |
| 1029 | - if ($kt_response->status_code != 0) | |
| 1030 | - { | |
| 1031 | - return new PEAR_Error($kt_response->message); | |
| 1032 | - } | |
| 1033 | - | |
| 1034 | - return true; | |
| 1035 | - } | |
| 1036 | - | |
| 1037 | - /** | |
| 1038 | - * Returns metadata on the document. | |
| 1039 | - * | |
| 1040 | - * @return kt_metadata_response | |
| 1041 | - */ | |
| 1042 | - function get_metadata() | |
| 1043 | - { | |
| 1044 | - $kt_metadata_response = $this->ktapi->soapclient->get_document_metadata($this->ktapi->session, $this->document_id ); | |
| 1045 | - if (SOAP_Client::isError($kt_metadata_response)) | |
| 1046 | - { | |
| 1047 | - return $kt_metadata_response; | |
| 1048 | - } | |
| 1049 | - | |
| 1050 | - if ($kt_metadata_response->status_code != 0) | |
| 1051 | - { | |
| 1052 | - return new PEAR_Error($kt_metadata_response->message); | |
| 1053 | - } | |
| 1054 | - | |
| 1055 | - return $kt_metadata_response; | |
| 1056 | - } | |
| 1057 | - | |
| 1058 | - /** | |
| 1059 | - * Updates the metadata on the current document. | |
| 1060 | - * | |
| 1061 | - * @param kt_metadata $metadata | |
| 1062 | - * @return true | |
| 1063 | - */ | |
| 1064 | - function update_metadata($metadata) | |
| 1065 | - { | |
| 1066 | - $kt_response = $this->ktapi->soapclient->update_document_metadata($this->ktapi->session, $this->document_id, $metadata); | |
| 1067 | - if (SOAP_Client::isError($kt_response)) | |
| 1068 | - { | |
| 1069 | - return $kt_response; | |
| 1070 | - } | |
| 1071 | - | |
| 1072 | - if ($kt_response->status_code != 0) | |
| 1073 | - { | |
| 1074 | - return new PEAR_Error($kt_response->message); | |
| 1075 | - } | |
| 1076 | - | |
| 1077 | - return true; | |
| 1078 | - } | |
| 1079 | - | |
| 1080 | - /** | |
| 1081 | - * Returns the transaction history on the current document. | |
| 1082 | - * | |
| 1083 | - * @return kt_document_transaction_history | |
| 1084 | - */ | |
| 1085 | - function get_transaction_history() | |
| 1086 | - { | |
| 1087 | - $kt_document_transaction_history_response = $this->ktapi->soapclient->get_document_transaction_history($this->ktapi->session, $this->document_id); | |
| 1088 | - if (SOAP_Client::isError($kt_document_transaction_history_response)) | |
| 1089 | - { | |
| 1090 | - return $kt_document_transaction_history_response; | |
| 1091 | - } | |
| 1092 | - | |
| 1093 | - if ($kt_document_transaction_history_response->status_code != 0) | |
| 1094 | - { | |
| 1095 | - return new PEAR_Error($kt_document_transaction_history_response->message); | |
| 1096 | - } | |
| 1097 | - | |
| 1098 | - return $kt_document_transaction_history_response->history; | |
| 1099 | - } | |
| 1100 | - | |
| 1101 | - /** | |
| 1102 | - * Returns the version history on the current document. | |
| 1103 | - * | |
| 1104 | - * @return $kt_document_version_history | |
| 1105 | - */ | |
| 1106 | - function get_version_history() | |
| 1107 | - { | |
| 1108 | - $kt_document_version_history_response = $this->ktapi->soapclient->get_document_version_history($this->ktapi->session, $this->document_id); | |
| 1109 | - if (SOAP_Client::isError($kt_document_version_history_response)) | |
| 1110 | - { | |
| 1111 | - return $kt_document_version_history_response; | |
| 1112 | - } | |
| 1113 | - | |
| 1114 | - if ($kt_document_version_history_response->status_code != 0) | |
| 1115 | - { | |
| 1116 | - return new PEAR_Error($kt_document_version_history_response->message); | |
| 1117 | - } | |
| 1118 | - | |
| 1119 | - return $kt_document_version_history_response->history; | |
| 1120 | - } | |
| 1121 | -} | |
| 1122 | - | |
| 1123 | -class KTWSAPI | |
| 1124 | -{ | |
| 1125 | - var $wsdl; | |
| 1126 | - /** | |
| 1127 | - * Enter description here... | |
| 1128 | - * | |
| 1129 | - * @var SOAP_Client | |
| 1130 | - */ | |
| 1131 | - var $soapclient; | |
| 1132 | - var $timeout; | |
| 1133 | - var $session; | |
| 1134 | - var $download_path; | |
| 1135 | - | |
| 1136 | - /** | |
| 1137 | - * Constructor | |
| 1138 | - * | |
| 1139 | - * @param string $wsdl | |
| 1140 | - * @param int $timeout | |
| 1141 | - * @return KTWSAPI | |
| 1142 | - */ | |
| 1143 | - function KTWSAPI($wsdl = KTWebService_WSDL, $timeout=30) | |
| 1144 | - { | |
| 1145 | - $this->wsdl = new SOAP_WSDL($wsdl); | |
| 1146 | - $this->timeout = $timeout; | |
| 1147 | - $this->soapclient = $this->wsdl->getProxy(); | |
| 1148 | - $this->soapclient->setOpt('timeout', $this->timeout); | |
| 1149 | - $this->download_path = 'c:/temp'; | |
| 1150 | - } | |
| 1151 | - | |
| 1152 | - /** | |
| 1153 | - * This returns the default location where documents are downloaded in download() and checkout(). | |
| 1154 | - * | |
| 1155 | - * @return string | |
| 1156 | - */ | |
| 1157 | - function get_download_path() | |
| 1158 | - { | |
| 1159 | - return $this->download_path; | |
| 1160 | - } | |
| 1161 | - | |
| 1162 | - /** | |
| 1163 | - * Allows the default location for downloaded documents to be changed. | |
| 1164 | - * | |
| 1165 | - * @param string $download_path | |
| 1166 | - * @return true | |
| 1167 | - */ | |
| 1168 | - function set_download_path($download_path) | |
| 1169 | - { | |
| 1170 | - if (!is_dir($download_path)) | |
| 1171 | - { | |
| 1172 | - return new PEAR_Error('local path is not writable'); | |
| 1173 | - } | |
| 1174 | - | |
| 1175 | - if (!is_writable($download_path)) | |
| 1176 | - { | |
| 1177 | - return new PEAR_Error('local path is not writable'); | |
| 1178 | - } | |
| 1179 | - $this->download_path = $download_path; | |
| 1180 | - return true; | |
| 1181 | - } | |
| 1182 | - | |
| 1183 | - /** | |
| 1184 | - * Starts an anonymous session. | |
| 1185 | - * | |
| 1186 | - * @param string $ip | |
| 1187 | - * @return string | |
| 1188 | - */ | |
| 1189 | - function start_anonymous_session($ip=null) | |
| 1190 | - { | |
| 1191 | - return $this->start_session('anonymous','',$ip); | |
| 1192 | - } | |
| 1193 | - | |
| 1194 | - /** | |
| 1195 | - * Starts a user session. | |
| 1196 | - * | |
| 1197 | - * @param string $username | |
| 1198 | - * @param string $password | |
| 1199 | - * @param string $ip | |
| 1200 | - * @return string | |
| 1201 | - */ | |
| 1202 | - function start_session($username, $password, $ip=null) | |
| 1203 | - { | |
| 1204 | - if (!is_null($this->session)) | |
| 1205 | - { | |
| 1206 | - return new PEAR_Error(KTWSAPI_ERR_SESSION_IN_USE); | |
| 1207 | - } | |
| 1208 | - $kt_response = $this->soapclient->login($username, $password, $ip); | |
| 1209 | - if (SOAP_Client::isError($kt_response)) | |
| 1210 | - { | |
| 1211 | - return $kt_response; | |
| 1212 | - } | |
| 1213 | - | |
| 1214 | - if ($kt_response->status_code == 0) | |
| 1215 | - { | |
| 1216 | - $this->session = $kt_response->message; | |
| 1217 | - } | |
| 1218 | - else | |
| 1219 | - { | |
| 1220 | - return new PEAR_Error($kt_response->message); | |
| 1221 | - } | |
| 1222 | - | |
| 1223 | - return $this->session; | |
| 1224 | - } | |
| 1225 | - | |
| 1226 | - /** | |
| 1227 | - * Sets an active session. | |
| 1228 | - * | |
| 1229 | - * @param string $session | |
| 1230 | - * @param string $ip | |
| 1231 | - * @return string | |
| 1232 | - */ | |
| 1233 | - function active_session($session, $ip=null) | |
| 1234 | - { | |
| 1235 | - if (!is_null($this->session)) | |
| 1236 | - { | |
| 1237 | - return new PEAR_Error(KTWSAPI_ERR_SESSION_IN_USE); | |
| 1238 | - } | |
| 1239 | - $this->session = $session; | |
| 1240 | - | |
| 1241 | - return $session; | |
| 1242 | - } | |
| 1243 | - | |
| 1244 | - /** | |
| 1245 | - * Closes an active session. | |
| 1246 | - * | |
| 1247 | - * @return true | |
| 1248 | - */ | |
| 1249 | - function logout() | |
| 1250 | - { | |
| 1251 | - if (is_null($this->session)) | |
| 1252 | - { | |
| 1253 | - return new PEAR_Error(KTWSAPI_ERR_SESSION_NOT_STARTED); | |
| 1254 | - } | |
| 1255 | - | |
| 1256 | - $kt_response = $this->soapclient->logout($this->session); | |
| 1257 | - | |
| 1258 | - if ($kt_response->status_code != 0) | |
| 1259 | - { | |
| 1260 | - return new PEAR_Error($kt_response->message); | |
| 1261 | - } | |
| 1262 | - $this->session = null; | |
| 1263 | - | |
| 1264 | - return true; | |
| 1265 | - } | |
| 1266 | - | |
| 1267 | - /** | |
| 1268 | - * Returns a reference to the root folder. | |
| 1269 | - * | |
| 1270 | - * @return KTWSAPI_Folder | |
| 1271 | - */ | |
| 1272 | - function &get_root_folder() | |
| 1273 | - { | |
| 1274 | - return $this->get_folder_by_id(1); | |
| 1275 | - } | |
| 1276 | - | |
| 1277 | - /** | |
| 1278 | - * Returns a reference to a folder based on id. | |
| 1279 | - * | |
| 1280 | - * @return KTWSAPI_Folder | |
| 1281 | - */ | |
| 1282 | - function &get_folder_by_id($folderid) | |
| 1283 | - { | |
| 1284 | - if (is_null($this->session)) | |
| 1285 | - { | |
| 1286 | - return new PEAR_Error('A session is not active'); | |
| 1287 | - } | |
| 1288 | - | |
| 1289 | - return KTWSAPI_Folder::get($this, $folderid); | |
| 1290 | - } | |
| 1291 | - | |
| 1292 | - /** | |
| 1293 | - * Returns a reference to a document based on id. | |
| 1294 | - * | |
| 1295 | - * @param int $documentid | |
| 1296 | - * @return KTWSAPI_Document | |
| 1297 | - */ | |
| 1298 | - function &get_document_by_id($documentid) | |
| 1299 | - { | |
| 1300 | - if (is_null($this->session)) | |
| 1301 | - { | |
| 1302 | - return new PEAR_Error('A session is not active'); | |
| 1303 | - } | |
| 1304 | - | |
| 1305 | - return KTWSAPI_Document::get($this, $documentid); | |
| 1306 | - } | |
| 1307 | -} | |
| 1308 | - | |
| 1309 | -?> |
ktwsapi/php/ktwsapi_cfg.inc.php deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Copyright (c) 2008, The Jam Warehouse Software (Pty) Ltd. | |
| 4 | - * | |
| 5 | - * All rights reserved. | |
| 6 | - * | |
| 7 | - * Redistribution and use in source and binary forms, with or without | |
| 8 | - * modification, are permitted provided that the following conditions are met: | |
| 9 | - * | |
| 10 | - * i) Redistributions of source code must retain the above copyright notice, | |
| 11 | - * this list of conditions and the following disclaimer. | |
| 12 | - * ii) Redistributions in binary form must reproduce the above copyright | |
| 13 | - * notice, this list of conditions and the following disclaimer in the | |
| 14 | - * documentation and/or other materials provided with the distribution. | |
| 15 | - * iii) Neither the name of the The Jam Warehouse Software (Pty) Ltd nor the | |
| 16 | - * names of its contributors may be used to endorse or promote products | |
| 17 | - * derived from this software without specific prior written permission. | |
| 18 | - * | |
| 19 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
| 23 | - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 24 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, | |
| 25 | - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ( INCLUDING | |
| 28 | - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | - */ | |
| 31 | - | |
| 32 | -/* | |
| 33 | - * This is the basic configuration for the KnowledgeTree WebService object model | |
| 34 | - */ | |
| 35 | - | |
| 36 | -// Path to PEAR libraries | |
| 37 | - | |
| 38 | -define('KT_PEAR_DIR', '/knowledgetree/ktdms.trunk/thirdparty/pear'); | |
| 39 | - | |
| 40 | -// URL to KnowledgeTree installation | |
| 41 | -// This must be configured by the administrator installing this component. | |
| 42 | - | |
| 43 | -define('KTWebServiceURL', 'http://localhost:80'); | |
| 44 | - | |
| 45 | -define('KTWebService_WSDL', KTWebServiceURL . '/ktwebservice/index.php?wsdl'); | |
| 46 | -define('KTUploadURL', KTWebServiceURL . '/ktwebservice/upload.php'); | |
| 47 | - | |
| 48 | -?> |
ktwsapi/python/TODO.txt deleted
ktwsapi/ruby/TODO.txt deleted
login.php
| ... | ... | @@ -8,32 +8,32 @@ |
| 8 | 8 | * KnowledgeTree Open Source Edition |
| 9 | 9 | * Document Management Made Simple |
| 10 | 10 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited |
| 11 | - * | |
| 11 | + * | |
| 12 | 12 | * This program is free software; you can redistribute it and/or modify it under |
| 13 | 13 | * the terms of the GNU General Public License version 3 as published by the |
| 14 | 14 | * Free Software Foundation. |
| 15 | - * | |
| 15 | + * | |
| 16 | 16 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 17 | 17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 18 | 18 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 19 | 19 | * details. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You should have received a copy of the GNU General Public License |
| 22 | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 25 | 25 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 26 | - * | |
| 26 | + * | |
| 27 | 27 | * The interactive user interfaces in modified source and object code versions |
| 28 | 28 | * of this program must display Appropriate Legal Notices, as required under |
| 29 | 29 | * Section 5 of the GNU General Public License version 3. |
| 30 | - * | |
| 30 | + * | |
| 31 | 31 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 32 | 32 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 33 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 33 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 34 | 34 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 35 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 36 | - * copyright notice. | |
| 35 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 36 | + * copyright notice. | |
| 37 | 37 | * Contributor( s): ______________________________________ |
| 38 | 38 | */ |
| 39 | 39 | |
| ... | ... | @@ -95,24 +95,24 @@ class LoginPageDispatcher extends KTDispatcher { |
| 95 | 95 | #var_dump($oUser); |
| 96 | 96 | #var_dump(PEAR::raiseError()); |
| 97 | 97 | } |
| 98 | - $iOldUserID = checkLastSessionUserID(); | |
| 99 | - | |
| 100 | - //if the current person logging in isn't the same person who logged out or timed out | |
| 101 | - //then set the redirect to the dashboard and not the last page that was viewed. | |
| 102 | - if ($oUser->getId() != $iOldUserID['user_id']) | |
| 98 | + | |
| 99 | + // If the last user from the same IP address timed out within the last hour then redirect to the dashboard | |
| 100 | + // Otherwise allow any other redirect to continue. | |
| 101 | + // The user might still be taken to the last page of the previous users session but | |
| 102 | + // if we always redirect to dashboard then we break other features such as linking in from emails or documents. | |
| 103 | + if (checkLastSessionUserID($oUser->getId())) | |
| 103 | 104 | { |
| 104 | 105 | $_REQUEST['redirect'] = generateControllerLink('dashboard'); |
| 105 | - | |
| 106 | 106 | } |
| 107 | - | |
| 107 | + | |
| 108 | 108 | $session = new Session(); |
| 109 | 109 | $sessionID = $session->create($oUser); |
| 110 | 110 | if (PEAR::isError($sessionID)) { |
| 111 | 111 | return $sessionID; |
| 112 | 112 | } |
| 113 | - | |
| 113 | + | |
| 114 | 114 | $redirect = KTUtil::arrayGet($_REQUEST, 'redirect'); |
| 115 | - | |
| 115 | + | |
| 116 | 116 | // DEPRECATED initialise page-level authorisation array |
| 117 | 117 | $_SESSION["pageAccess"] = NULL; |
| 118 | 118 | |
| ... | ... | @@ -156,9 +156,9 @@ class LoginPageDispatcher extends KTDispatcher { |
| 156 | 156 | |
| 157 | 157 | $errorMessage = KTUtil::arrayGet($_REQUEST, 'errorMessage'); |
| 158 | 158 | session_start(); |
| 159 | - | |
| 159 | + | |
| 160 | 160 | $errorMessageConfirm = $_SESSION['errormessage']['login']; |
| 161 | - | |
| 161 | + | |
| 162 | 162 | $redirect = KTUtil::arrayGet($_REQUEST, 'redirect'); |
| 163 | 163 | |
| 164 | 164 | $oReg =& KTi18nregistry::getSingleton(); |
| ... | ... | @@ -337,16 +337,46 @@ class LoginPageDispatcher extends KTDispatcher { |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | -//FIXME Direct Database Access | |
| 341 | -//checkLastSessionUserID finds the last user to logout or timeout | |
| 342 | -function checkLastSessionUserID() | |
| 340 | +/** | |
| 341 | + * Check if the last user logging in from the same IP as the current user timed out in the last hour. | |
| 342 | + * | |
| 343 | + * @param unknown_type $userId | |
| 344 | + * @return unknown | |
| 345 | + */ | |
| 346 | +function checkLastSessionUserID($userId) | |
| 343 | 347 | { |
| 344 | - $sQuery = 'SELECT user_id FROM user_history ORDER BY id DESC LIMIT 1'; | |
| 345 | - $res = DBUtil::getOneResult($sQuery); | |
| 346 | - return $res; | |
| 348 | + // Get the current users IP Address | |
| 349 | + $sIp = '%'.$_SERVER['REMOTE_ADDR']; | |
| 350 | + | |
| 351 | + // Get the time for a day ago and an hour ago | |
| 352 | + $dif = time() - (24*60*60); | |
| 353 | + $sDayAgo = date('Y-m-d H:i:s', $dif); | |
| 354 | + $dif2 = time() - (60*60); | |
| 355 | + $sHourAgo = date('Y-m-d H:i:s', $dif2); | |
| 356 | + | |
| 357 | + // Get the session id for the last user to log in from the current IP address within the last day | |
| 358 | + // Use the session id to find if that user logged out or timed out within the last hour. | |
| 359 | + $sQuery = 'SELECT user_id, action_namespace FROM user_history | |
| 360 | + WHERE datetime > ? AND | |
| 361 | + session_id = (SELECT session_id FROM user_history WHERE comments LIKE ? AND datetime > ? ORDER BY id DESC LIMIT 1) | |
| 362 | + ORDER BY id DESC LIMIT 1'; | |
| 363 | + | |
| 364 | + $aParams = array($sHourAgo, $sIp, $sDayAgo); | |
| 365 | + $res = DBUtil::getOneResult(array($sQuery, $aParams)); | |
| 366 | + | |
| 367 | + if(PEAR::isError($res) || empty($res)){ | |
| 368 | + return false; | |
| 369 | + } | |
| 370 | + | |
| 371 | + // Check whether the user timed out and whether it was the current user or a different one | |
| 372 | + if($res['action_namespace'] == 'ktcore.user_history.timeout' && $res['user_id'] != $userId){ | |
| 373 | + return true; | |
| 374 | + } | |
| 375 | + | |
| 376 | + return false; | |
| 347 | 377 | } |
| 348 | 378 | |
| 349 | 379 | $dispatcher =& new LoginPageDispatcher(); |
| 350 | 380 | $dispatcher->dispatch(); |
| 351 | 381 | |
| 352 | 382 | -?> |
| 383 | +?> | |
| 353 | 384 | \ No newline at end of file | ... | ... |
plugins/rssplugin/KTrss.inc.php
| ... | ... | @@ -336,111 +336,145 @@ class KTrss{ |
| 336 | 336 | $sSuffix = ''; |
| 337 | 337 | } |
| 338 | 338 | $hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$sSuffix; |
| 339 | - $feed = "<?xml version=\"1.0\"?>\n"; | |
| 340 | - $feed .= "<rss version=\"2.0\">\n". | |
| 341 | - "<channel>\n" . | |
| 342 | - "<title>".APP_NAME." RSS</title>\n" . | |
| 343 | - "<copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n" . | |
| 344 | - "<link>".$hostPath."</link>\n" . | |
| 345 | - "<description>KT-RSS</description>\n" . | |
| 346 | - "<image>\n". | |
| 347 | - "<title>".APP_NAME." RSS</title>\n". | |
| 348 | - "<width>140</width>\n". | |
| 349 | - "<height>28</height>". | |
| 350 | - "<link>".$hostPath."knowledgeTree/</link>\n". | |
| 351 | - "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n". | |
| 352 | - "</image>\n"; | |
| 353 | - foreach($aItems as $aItems){ | |
| 354 | - if($aItems[0][itemType] == 'folder'){ | |
| 355 | - $sTypeSelect = 'folder.transactions&fFolderId'; | |
| 356 | - }elseif($aItems[0][itemType] == 'document'){ | |
| 357 | - $sTypeSelect = 'document.transactionhistory&fDocumentId'; | |
| 339 | + | |
| 340 | + $head = "<?xml version=\"1.0\"?>\n | |
| 341 | + <rss version=\"2.0\">\n | |
| 342 | + <channel>\n | |
| 343 | + <title>".APP_NAME." RSS</title>\n | |
| 344 | + <copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n | |
| 345 | + <link>".$hostPath."</link>\n | |
| 346 | + <description>KT-RSS</description>\n | |
| 347 | + <image>\n | |
| 348 | + <title>".APP_NAME." RSS</title>\n | |
| 349 | + <width>140</width>\n | |
| 350 | + <height>28</height> | |
| 351 | + <link>".$hostPath."knowledgeTree/</link>\n | |
| 352 | + <url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n | |
| 353 | + </image>\n"; | |
| 354 | + | |
| 355 | + | |
| 356 | + $feed = ''; | |
| 357 | + foreach($aItems as $aItem){ | |
| 358 | + | |
| 359 | + $aItemHead = $aItem[0][0]; | |
| 360 | + $aItemList = $aItem[1]; | |
| 361 | + | |
| 362 | + if($aItem[0][itemType] == 'folder'){ | |
| 363 | + $sTypeSelect = 'folder.transactions&fFolderId'; | |
| 364 | + }elseif($aItem[0][itemType] == 'document'){ | |
| 365 | + $sTypeSelect = 'document.transactionhistory&fDocumentId'; | |
| 358 | 366 | } |
| 359 | - $feed .= "<item>\n" . | |
| 360 | - "<title>".htmlentities(KTrss::rss_sanitize($aItems[0][0][name],false), ENT_QUOTES, 'UTF-8')."</title>\n" . | |
| 361 | - "<link>".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."</link>\n" . | |
| 362 | - "<description>\n" . | |
| 363 | - "<table border='0' width='90%'>\n". | |
| 364 | - "<tr>\n". | |
| 365 | - "<td width='5%' height='16px'>" . | |
| 366 | - "<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>" . | |
| 367 | - "</td>\n". | |
| 368 | - "<td align='left'> ".$aItems[0][mimeTypeFName]."</td>\n". | |
| 369 | - "</tr>\n". | |
| 370 | - "<tr>\n". | |
| 371 | - "<td colspan='2'>\n". | |
| 372 | - ucfirst($aItems[0]['itemType'])." Information (ID: ".$aItems[0][0][id].")</>\n". | |
| 373 | - "<hr>\n". | |
| 374 | - "<table width='95%'>\n". | |
| 375 | - "<tr>\n". | |
| 376 | - "<td>Filename: ".KTrss::rss_sanitize($aItems[0][0][filename])."</td>\n". | |
| 377 | - "<td>\n". | |
| 378 | - "</tr>\n". | |
| 379 | - "<tr>\n". | |
| 380 | - "<td>Author: ".$aItems[0][0][author]."</td>\n". | |
| 381 | - "<td>\n". | |
| 382 | - "</tr>\n". | |
| 383 | - "<tr>\n". | |
| 384 | - "<td>Owner: ";if($aItems[0][0][owner]){$feed .= $aItems[0][0][owner];}else{$feed .= "None";} | |
| 385 | - $feed .= "</td>\n". | |
| 386 | - "<td></td>\n". | |
| 387 | - "</tr>\n". | |
| 388 | - "<tr>\n";if($aItems[0][0][type]){ | |
| 389 | - $feed .= "<td>Document type: ".$aItems[0][0][type]."</td>\n". | |
| 390 | - "<td></td>\n";} | |
| 391 | - $feed .= "</tr>\n". | |
| 392 | - "<tr>\n". | |
| 393 | - "<td>Workflow status: ";if($aItems[0][0][workflow_status]){$feed .= $aItems[0][0][workflow_status];}else{$feed .= "No Workflow";} | |
| 394 | - $feed .= "</td>\n". | |
| 395 | - "<td></td>\n". | |
| 396 | - "</tr>\n". | |
| 397 | - "</table><br>\n". | |
| 398 | - "Transaction Summary (Last 4)\n". | |
| 399 | - "<hr>\n". | |
| 400 | - "<table width='100%'>\n"; | |
| 401 | - foreach($aItems[1] as $item){ | |
| 402 | - $feed .= "<tr>\n". | |
| 403 | - "<td>".$item[type]." name:</td>\n". | |
| 404 | - "<td>".KTrss::rss_sanitize($item[name] )."</td>\n". | |
| 405 | - "</tr>\n". | |
| 406 | - "<tr>\n". | |
| 407 | - "<td>Path:</td>\n". | |
| 408 | - "<td>".KTrss::rss_sanitize($item[fullpath] )."</td>\n". | |
| 409 | - "</tr>\n". | |
| 410 | - "<tr>\n". | |
| 411 | - "<td>Transaction:</td>\n". | |
| 412 | - "<td>".$item[transaction_name]."</td>\n". | |
| 413 | - "</tr>\n". | |
| 414 | - "<tr>\n". | |
| 415 | - "<td>Comment:</td>\n". | |
| 416 | - "<td>".KTrss::rss_sanitize($item[comment] )."</td>\n". | |
| 417 | - "</tr>\n". | |
| 418 | - "<tr>\n";if($item[version]){ | |
| 419 | - $feed .= "<td>Version:</td>\n". | |
| 420 | - "<td>".$item[version]."</td>\n";} | |
| 421 | - $feed .= "</tr>\n". | |
| 422 | - "<tr>\n". | |
| 423 | - "<td>Date:</td>\n". | |
| 424 | - "<td>".$item[datetime]."</td>\n". | |
| 425 | - "</tr>\n". | |
| 426 | - "<tr>\n". | |
| 427 | - "<td>User:</td>\n". | |
| 428 | - "<td>".$item[user_name]."</td>\n". | |
| 429 | - "</tr>\n". | |
| 430 | - "<tr>\n". | |
| 431 | - "<td colspan='2'><hr width='100' align='left'></td>\n". | |
| 432 | - "</tr>\n";} | |
| 433 | - $feed .= "</table>\n". | |
| 434 | - "</td>\n". | |
| 435 | - "</tr>\n". | |
| 436 | - "</table>". | |
| 437 | - "</description>\n". | |
| 438 | - "</item>\n"; | |
| 367 | + | |
| 368 | + | |
| 369 | + if($aItem[0][0][owner]){ | |
| 370 | + $owner = $aItem[0][0][owner]; | |
| 371 | + }else{ | |
| 372 | + $owner = _kt('None'); | |
| 373 | + } | |
| 374 | + | |
| 375 | + $type = ''; | |
| 376 | + if($aItem[0][0][type]){ | |
| 377 | + $type = '<tr><td>Document type: '.$aItem[0][0][type]."</td>\n<td></td></tr>\n"; | |
| 378 | + } | |
| 379 | + | |
| 380 | + if($aItem[0][0][workflow_status]){ | |
| 381 | + $workflow = $aItem[0][0][workflow_status]; | |
| 382 | + }else{ | |
| 383 | + $workflow = _kt('No Workflow'); | |
| 384 | + } | |
| 385 | + | |
| 386 | + $xmlItemHead = "<item>\n | |
| 387 | + <title>".htmlentities($aItem[0][0][name], ENT_QUOTES, 'UTF-8')."</title>\n | |
| 388 | + <link>".$hostPath."action.php?kt_path_info=ktcore.actions.".htmlentities($sTypeSelect, ENT_QUOTES, 'UTF-8')."=".$aItem[0][0]['id']."</link>\n | |
| 389 | + <description>\n"; | |
| 390 | + | |
| 391 | + $htmlItem = "<table border='0' width='90%'>\n | |
| 392 | + <tr>\n | |
| 393 | + <td width='5%' height='16px'> | |
| 394 | + <a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItem[0][0][id]."' > | |
| 395 | + <img src='".$aItem[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a> | |
| 396 | + </td>\n | |
| 397 | + <td align='left'> ".$aItem[0][mimeTypeFName]."</td>\n | |
| 398 | + </tr>\n | |
| 399 | + <tr>\n | |
| 400 | + <td colspan='2'>\n | |
| 401 | + ".ucfirst($aItem[0]['itemType'])." Information (ID: ".$aItem[0][0][id].")</>\n | |
| 402 | + <hr>\n | |
| 403 | + | |
| 404 | + <table width='95%'>\n | |
| 405 | + <tr>\n | |
| 406 | + <td>"._kt('Filename').": ".$aItem[0][0][filename]."</td>\n | |
| 407 | + </tr>\n | |
| 408 | + <tr>\n | |
| 409 | + <td>"._kt('Author').": ".$aItem[0][0][author]."</td>\n | |
| 410 | + </tr>\n | |
| 411 | + <tr>\n | |
| 412 | + <td>"._kt('Owner').": ".$owner."</td>\n | |
| 413 | + <td></td>\n | |
| 414 | + </tr>\n | |
| 415 | + ".$type."\n | |
| 416 | + <tr>\n | |
| 417 | + <td>"._kt('Workflow status').": ".$workflow."</td>\n | |
| 418 | + <td></td>\n | |
| 419 | + </tr>\n | |
| 420 | + </table><br>\n | |
| 421 | + | |
| 422 | + "._kt('Transaction Summary (Last 4)')."\n | |
| 423 | + <hr>\n | |
| 424 | + | |
| 425 | + <table width='100%'>\n"; | |
| 426 | + | |
| 427 | + foreach($aItem[1] as $item){ | |
| 428 | + $htmlItem .= "<tr>\n | |
| 429 | + <td>".$item[type]." name:</td>\n | |
| 430 | + <td>".$item[name]."</td>\n | |
| 431 | + </tr>\n | |
| 432 | + <tr>\n | |
| 433 | + <td>Path:</td>\n | |
| 434 | + <td>".$item[fullpath]."</td>\n | |
| 435 | + </tr>\n | |
| 436 | + <tr>\n | |
| 437 | + <td>Transaction:</td>\n | |
| 438 | + <td>".$item[transaction_name]."</td>\n | |
| 439 | + </tr>\n | |
| 440 | + <tr>\n | |
| 441 | + <td>Comment:</td>\n | |
| 442 | + <td>".$item[comment]."</td>\n | |
| 443 | + </tr>\n | |
| 444 | + <tr>\n"; | |
| 445 | + | |
| 446 | + if($item[version]){ | |
| 447 | + $htmlItem .= "<td>Version:</td>\n | |
| 448 | + <td>".$item[version]."</td>\n"; | |
| 449 | + } | |
| 450 | + $htmlItem .= "</tr>\n | |
| 451 | + <tr>\n | |
| 452 | + <td>Date:</td>\n | |
| 453 | + <td>".$item[datetime]."</td>\n | |
| 454 | + </tr>\n | |
| 455 | + <tr>\n | |
| 456 | + <td>User:</td>\n | |
| 457 | + <td>".$item[user_name]."</td>\n | |
| 458 | + </tr>\n | |
| 459 | + <tr>\n | |
| 460 | + <td colspan='2'><hr width='100' align='left'></td>\n | |
| 461 | + </tr>\n"; | |
| 462 | + } | |
| 463 | + $htmlItem .= "</table>\n | |
| 464 | + </td>\n | |
| 465 | + </tr>\n | |
| 466 | + </table>"; | |
| 467 | + | |
| 468 | + $xmlItemFooter = "</description>\n</item>\n"; | |
| 469 | + | |
| 470 | + // Use htmlentities to allow html tags in the xml. | |
| 471 | + $htmlItem = htmlentities($htmlItem, ENT_QUOTES, 'UTF-8'); | |
| 472 | + | |
| 473 | + $feed .= $xmlItemHead.$htmlItem.$xmlItemFooter; | |
| 439 | 474 | } |
| 440 | - $feed .= "</channel>\n" . | |
| 441 | - "</rss>\n"; | |
| 475 | + $footer = "</channel>\n</rss>\n"; | |
| 442 | 476 | |
| 443 | - return $feed; | |
| 477 | + return $head.$feed.$footer; | |
| 444 | 478 | } |
| 445 | 479 | |
| 446 | 480 | // Takes in an array as a parameter and returns rss2.0 compatible xml |
| ... | ... | @@ -449,26 +483,28 @@ class KTrss{ |
| 449 | 483 | $aPath = explode('/', trim($_SERVER['PHP_SELF'])); |
| 450 | 484 | global $default; |
| 451 | 485 | $hostPath = "http" . ($default->sslEnabled ? "s" : "") . "://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; |
| 452 | - $feed = "<?xml version=\"1.0\"?>\n"; | |
| 453 | - $feed .= "<rss version=\"2.0\">\n". | |
| 454 | - "<channel>\n" . | |
| 455 | - "<title>".APP_NAME." RSS</title>\n" . | |
| 456 | - "<copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n" . | |
| 457 | - "<link>".$hostPath."</link>\n" . | |
| 458 | - "<description>KT-RSS</description>\n" . | |
| 459 | - "<image>\n". | |
| 460 | - "<title>".APP_NAME." RSS</title>\n". | |
| 461 | - "<width>140</width>\n". | |
| 462 | - "<height>28</height>". | |
| 463 | - "<link>".$hostPath."knowledgeTree/</link>\n". | |
| 464 | - "<url>".$hostPath."resources/graphics/ktlogo_rss.png</url>\n". | |
| 465 | - "</image>\n"; | |
| 466 | - $feed .= "<item>\n". | |
| 467 | - "<title>Feed load error</title>\n" . | |
| 468 | - "<description>".$sError."</description>\n". | |
| 469 | - "</item>\n"; | |
| 470 | - $feed .= "</channel>\n" . | |
| 471 | - "</rss>\n"; | |
| 486 | + $feed = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n | |
| 487 | + <rss version=\"2.0\">\n | |
| 488 | + | |
| 489 | + <channel>\n | |
| 490 | + <title>".APP_NAME." RSS</title>\n | |
| 491 | + <copyright>(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved</copyright>\n | |
| 492 | + <link>{$hostPath}</link>\n | |
| 493 | + <description>KT-RSS</description>\n | |
| 494 | + <image>\n | |
| 495 | + <title>".APP_NAME." RSS</title>\n | |
| 496 | + <width>140</width>\n | |
| 497 | + <height>28</height> | |
| 498 | + <link>{$hostPath}knowledgeTree/</link>\n | |
| 499 | + <url>{$hostPath}resources/graphics/ktlogo_rss.png</url>\n | |
| 500 | + </image>\n | |
| 501 | + <item>\n | |
| 502 | + <title>Feed load error</title>\n | |
| 503 | + <description>".$sError."</description>\n | |
| 504 | + </item>\n | |
| 505 | + </channel>\n | |
| 506 | + | |
| 507 | + </rss>\n"; | |
| 472 | 508 | |
| 473 | 509 | return $feed; |
| 474 | 510 | } | ... | ... |
resources/css/kt-framing.css
rss.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | */ |
| 36 | 36 | |
| ... | ... | @@ -66,75 +66,79 @@ if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) { |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { |
| 69 | - header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); | |
| 70 | - header('HTTP/1.0 401 Unauthorized'); | |
| 71 | - echo 'This RSS feed requires authentication. Please enter your username and password.'; | |
| 72 | - exit; | |
| 69 | + header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); | |
| 70 | + header('HTTP/1.0 401 Unauthorized'); | |
| 71 | + echo 'This RSS feed requires authentication. Please enter your username and password.'; | |
| 72 | + exit; | |
| 73 | 73 | } else { |
| 74 | - $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',)); | |
| 75 | - $id = $user[$_SERVER['PHP_AUTH_USER']]['id']; | |
| 74 | + $user = DBAuthenticator::getUser($_SERVER['PHP_AUTH_USER'], array('id'=>'id',)); | |
| 75 | + $id = $user[$_SERVER['PHP_AUTH_USER']]['id']; | |
| 76 | 76 | |
| 77 | + header('Content-Type: application/rss+xml; charset=utf-8;'); | |
| 78 | + header('Content-Disposition: inline; filename="rss.xml"'); | |
| 79 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); | |
| 80 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); | |
| 77 | 81 | |
| 78 | - if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed | |
| 79 | - // get document id from http request object | |
| 80 | - $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId'); | |
| 82 | + if(KTUtil::arrayGet($_REQUEST, 'docId')){ // if a docId parameter is passed | |
| 83 | + // get document id from http request object | |
| 84 | + $iDocumentId = KTUtil::arrayGet($_REQUEST, 'docId'); | |
| 81 | 85 | |
| 82 | - if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check | |
| 83 | - // get document info | |
| 84 | - $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id); | |
| 86 | + if(KTrss::validateDocumentPermissions($id, $iDocumentId)){ // if document passes validation check | |
| 87 | + // get document info | |
| 88 | + $aDocumentInfo[] = KTrss::getOneDocument($iDocumentId, $id); | |
| 85 | 89 | |
| 86 | - if($aDocumentInfo){ | |
| 87 | - // create rss xml for document | |
| 88 | - $documentFeed = KTrss::arrayToXML($aDocumentInfo); | |
| 89 | - }else{ | |
| 90 | - // create rss xml for the error | |
| 91 | - $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 92 | - } | |
| 93 | - }else{ | |
| 94 | - // create rss xml for error | |
| 95 | - $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' . | |
| 96 | - ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.')); | |
| 97 | - } | |
| 98 | - if(isset($error)){ // if an error exist, output...else out the result | |
| 99 | - echo $error; | |
| 100 | - }else{ | |
| 101 | - echo $documentFeed; | |
| 102 | - } | |
| 103 | - }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed | |
| 104 | - // get folder id from http request object | |
| 105 | - $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId'); | |
| 90 | + if($aDocumentInfo){ | |
| 91 | + // create rss xml for document | |
| 92 | + $documentFeed = KTrss::arrayToXML($aDocumentInfo); | |
| 93 | + }else{ | |
| 94 | + // create rss xml for the error | |
| 95 | + $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 96 | + } | |
| 97 | + }else{ | |
| 98 | + // create rss xml for error | |
| 99 | + $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this document or it does not exist.' . | |
| 100 | + ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid document.')); | |
| 101 | + } | |
| 102 | + if(isset($error)){ // if an error exist, output...else out the result | |
| 103 | + echo $error; | |
| 104 | + }else{ | |
| 105 | + echo $documentFeed; | |
| 106 | + } | |
| 107 | + }elseif(KTUtil::arrayGet($_REQUEST, 'folderId')){ // if a folderId parameter is passed | |
| 108 | + // get folder id from http request object | |
| 109 | + $iFolderId = KTUtil::arrayGet($_REQUEST, 'folderId'); | |
| 106 | 110 | |
| 107 | - if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check | |
| 108 | - // get folder info | |
| 109 | - $aFolderInfo[] = KTrss::getOneFolder($iFolderId); | |
| 111 | + if(KTrss::validateFolderPermissions($id, $iFolderId)){ // if folder passes validation check | |
| 112 | + // get folder info | |
| 113 | + $aFolderInfo[] = KTrss::getOneFolder($iFolderId); | |
| 110 | 114 | |
| 111 | - if($aFolderInfo){ | |
| 112 | - // create rss xml for folder | |
| 113 | - $folderFeed = KTrss::arrayToXML($aFolderInfo); | |
| 114 | - }else{ | |
| 115 | - // create rss xml for error | |
| 116 | - $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 117 | - } | |
| 118 | - }else{ | |
| 119 | - // create rss xml for error | |
| 120 | - $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' . | |
| 121 | - ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.')); | |
| 122 | - } | |
| 123 | - if(isset($error)){ // if an error exist, output...else out the result | |
| 124 | - echo $error; | |
| 125 | - }else{ | |
| 126 | - echo $folderFeed; | |
| 127 | - } | |
| 128 | - }else{ // else do normal rss parsing | |
| 129 | - // get full list of subscribed documents and folders | |
| 130 | - $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id)); | |
| 131 | - $internalFeed = KTrss::arrayToXML($aFullList); | |
| 132 | - echo $internalFeed; | |
| 133 | - } | |
| 115 | + if($aFolderInfo){ | |
| 116 | + // create rss xml for folder | |
| 117 | + $folderFeed = KTrss::arrayToXML($aFolderInfo); | |
| 118 | + }else{ | |
| 119 | + // create rss xml for error | |
| 120 | + $error = KTrss::errorToXML(_kt('This document has returned a empty response')); | |
| 121 | + } | |
| 122 | + }else{ | |
| 123 | + // create rss xml for error | |
| 124 | + $error = KTrss::errorToXML(_kt('You are either not authorised to view details on this folder or it does not exist.' . | |
| 125 | + ' Please visit http://' .$_SERVER['HTTP_HOST'].'/'.$GLOBALS['KTRootUrl'].'/ to browse for a valid folder.')); | |
| 126 | + } | |
| 127 | + if(isset($error)){ // if an error exist, output...else out the result | |
| 128 | + echo $error; | |
| 129 | + }else{ | |
| 130 | + echo $folderFeed; | |
| 131 | + } | |
| 132 | + }else{ // else do normal rss parsing | |
| 133 | + // get full list of subscribed documents and folders | |
| 134 | + $aFullList = kt_array_merge(KTrss::getDocuments($id), KTrss::getFolders($id)); | |
| 135 | + $internalFeed = KTrss::arrayToXML($aFullList); | |
| 136 | + echo $internalFeed; | |
| 137 | + } | |
| 134 | 138 | } |
| 135 | 139 | |
| 136 | 140 | // Validate user credentials |
| 137 | 141 | function validateUser($username, $password){ |
| 138 | - return DBAuthenticator::checkPassword($username, $password); | |
| 142 | + return DBAuthenticator::checkPassword($username, $password); | |
| 139 | 143 | } |
| 140 | 144 | -?> |
| 145 | +?> | |
| 141 | 146 | \ No newline at end of file | ... | ... |
sql/mysql/install/data.sql
| ... | ... | @@ -765,7 +765,9 @@ INSERT INTO `plugins` VALUES |
| 765 | 765 | (18,'ktstandard.disclaimers.plugin','plugins/ktstandard/KTDisclaimers.php',0,0,NULL,0,'Disclaimers Plugin',0), |
| 766 | 766 | (19,'nbm.browseable.plugin','plugins/browseabledashlet/BrowseableDashletPlugin.php',0,0,NULL,0,'Orphaned Folders Plugin',0), |
| 767 | 767 | (20,'ktstandard.ktwebdavdashlet.plugin','plugins/ktstandard/KTWebDAVDashletPlugin.php',0,0,NULL,0,'WebDAV Dashlet Plugin',0), |
| 768 | - (21,'ktcore.housekeeper.plugin','plugins/housekeeper/HouseKeeperPlugin.php',0,0,NULL,0,'Housekeeper',0); | |
| 768 | + (21,'ktcore.housekeeper.plugin','plugins/housekeeper/HouseKeeperPlugin.php',0,0,NULL,0,'Housekeeper',0), | |
| 769 | + (22,'ktcore.scheduler.plugin','plugins/ktcore/scheduler/KTSchedulerPlugin.php',0,0,NULL,0,'Task Scheduler Plugin',0), | |
| 770 | + (23,'ktcore.schedulerdashlet.plugin','plugins/ktcore/scheduler/schedulerDashletPlugin.php',0,0,NULL,0,'Scheduler Dashlet Plugin',0); | |
| 769 | 771 | /*!40000 ALTER TABLE `plugins` ENABLE KEYS */; |
| 770 | 772 | UNLOCK TABLES; |
| 771 | 773 | |
| ... | ... | @@ -1680,7 +1682,7 @@ UNLOCK TABLES; |
| 1680 | 1682 | |
| 1681 | 1683 | LOCK TABLES `zseq_plugins` WRITE; |
| 1682 | 1684 | /*!40000 ALTER TABLE `zseq_plugins` DISABLE KEYS */; |
| 1683 | -INSERT INTO `zseq_plugins` VALUES (21); | |
| 1685 | +INSERT INTO `zseq_plugins` VALUES (23); | |
| 1684 | 1686 | /*!40000 ALTER TABLE `zseq_plugins` ENABLE KEYS */; |
| 1685 | 1687 | UNLOCK TABLES; |
| 1686 | 1688 | ... | ... |
templates/ktcore/principals/about.smarty
| ... | ... | @@ -11,7 +11,7 @@ KnowledgeTree&trade; is a <a href="http://www.knowledgetree.com/About/legal/trad |
| 11 | 11 | </p> |
| 12 | 12 | <p> |
| 13 | 13 | <strong>KnowledgeTree is a business unit of The Jam Warehouse Software (Pty) Ltd.</strong><br /> |
| 14 | -Unit 1, Tramber Place, Blake Street, Observatory, Cape Town, 7925 South Africa, +27 21 4477440, <a href="http://www.knowledgetree.com">http://www.knowledgetree.com</a><br /> | |
| 14 | +<a href="http://www.knowledgetree.com">http://www.knowledgetree.com</a><br /> | |
| 15 | 15 | </p> |
| 16 | 16 | <p> |
| 17 | 17 | <strong>KnowledgeTree Sales</strong><br /> | ... | ... |