# # old_revision [b55c3d5a2d3c3107e576e9f623b23f17454a9a63] # # delete "sope-appserver/NGObjWeb/SoObjects/SoObjectXmlRpcDispatcher.h" # # delete "sope-appserver/NGObjWeb/SoObjects/SoObjectXmlRpcDispatcher.m" # # delete "sope-appserver/NGXmlRpc" # # delete "sope-appserver/NGXmlRpc/ChangeLog" # # delete "sope-appserver/NGXmlRpc/EOFetchSpecification+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/EOKeyGlobalID+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/EONull+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/EOQualifier+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/EOSortOrdering+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/GNUmakefile" # # delete "sope-appserver/NGXmlRpc/GNUmakefile.preamble" # # delete "sope-appserver/NGXmlRpc/NGAsyncResultProxy.h" # # delete "sope-appserver/NGXmlRpc/NGAsyncResultProxy.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpc-Info.plist" # # delete "sope-appserver/NGXmlRpc/NGXmlRpc.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcAction+Registry.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcAction.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcAction.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcClient.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcClient.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcInvocation.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcInvocation.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcMethodSignature.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcMethodSignature.m" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcRequestHandler.h" # # delete "sope-appserver/NGXmlRpc/NGXmlRpcRequestHandler.m" # # delete "sope-appserver/NGXmlRpc/NSObject+Reflection.h" # # delete "sope-appserver/NGXmlRpc/NSObject+Reflection.m" # # delete "sope-appserver/NGXmlRpc/Version" # # delete "sope-appserver/NGXmlRpc/WODirectAction+XmlRpc.h" # # delete "sope-appserver/NGXmlRpc/WODirectAction+XmlRpc.m" # # delete "sope-appserver/NGXmlRpc/WODirectAction+XmlRpcIntrospection.h" # # delete "sope-appserver/NGXmlRpc/WODirectAction+XmlRpcIntrospection.m" # # delete "sope-appserver/NGXmlRpc/WOMessage+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/WORequest+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/WOResponse+XmlRpcCoding.m" # # delete "sope-appserver/NGXmlRpc/XmlRpcMethodCall+WO.h" # # delete "sope-appserver/NGXmlRpc/XmlRpcMethodCall+WO.m" # # delete "sope-appserver/NGXmlRpc/XmlRpcMethodResponse+WO.h" # # delete "sope-appserver/NGXmlRpc/XmlRpcMethodResponse+WO.m" # # delete "sope-appserver/NGXmlRpc/common.h" # # delete "sope-appserver/NGXmlRpc/fhs.make" # # delete "sope-appserver/PROJECTLEAD" # # delete "sope-appserver/SoOFS" # # delete "sope-appserver/SoOFS/ChangeLog" # # delete "sope-appserver/SoOFS/GNUmakefile" # # delete "sope-appserver/SoOFS/GNUmakefile.preamble" # # delete "sope-appserver/SoOFS/OFSBaseObject.h" # # delete "sope-appserver/SoOFS/OFSBaseObject.m" # # delete "sope-appserver/SoOFS/OFSChangeLog.h" # # delete "sope-appserver/SoOFS/OFSChangeLog.m" # # delete "sope-appserver/SoOFS/OFSFactoryContext.h" # # delete "sope-appserver/SoOFS/OFSFactoryContext.m" # # delete "sope-appserver/SoOFS/OFSFactoryRegistry.h" # # delete "sope-appserver/SoOFS/OFSFactoryRegistry.m" # # delete "sope-appserver/SoOFS/OFSFile.h" # # delete "sope-appserver/SoOFS/OFSFile.m" # # delete "sope-appserver/SoOFS/OFSFileRenderer.h" # # delete "sope-appserver/SoOFS/OFSFileRenderer.m" # # delete "sope-appserver/SoOFS/OFSFolder+SoDAV.m" # # delete "sope-appserver/SoOFS/OFSFolder.h" # # delete "sope-appserver/SoOFS/OFSFolder.m" # # delete "sope-appserver/SoOFS/OFSFolderClassDescription.h" # # delete "sope-appserver/SoOFS/OFSFolderClassDescription.m" # # delete "sope-appserver/SoOFS/OFSFolderDataSource.h" # # delete "sope-appserver/SoOFS/OFSFolderDataSource.m" # # delete "sope-appserver/SoOFS/OFSHttpPasswd.h" # # delete "sope-appserver/SoOFS/OFSHttpPasswd.m" # # delete "sope-appserver/SoOFS/OFSImage.h" # # delete "sope-appserver/SoOFS/OFSImage.m" # # delete "sope-appserver/SoOFS/OFSPropertyListObject.h" # # delete "sope-appserver/SoOFS/OFSPropertyListObject.m" # # delete "sope-appserver/SoOFS/OFSResourceManager.h" # # delete "sope-appserver/SoOFS/OFSResourceManager.m" # # delete "sope-appserver/SoOFS/OFSWebDocument.h" # # delete "sope-appserver/SoOFS/OFSWebDocument.m" # # delete "sope-appserver/SoOFS/OFSWebMethod.h" # # delete "sope-appserver/SoOFS/OFSWebMethod.m" # # delete "sope-appserver/SoOFS/OFSWebMethodRenderer.h" # # delete "sope-appserver/SoOFS/OFSWebMethodRenderer.m" # # delete "sope-appserver/SoOFS/OFSWebTemplate.h" # # delete "sope-appserver/SoOFS/OFSWebTemplate.m" # # delete "sope-appserver/SoOFS/README" # # delete "sope-appserver/SoOFS/SoOFS-Info.plist" # # delete "sope-appserver/SoOFS/SoOFS-SXP-Info.plist" # # delete "sope-appserver/SoOFS/SoOFS.h" # # delete "sope-appserver/SoOFS/SoOFSProduct.m" # # delete "sope-appserver/SoOFS/TODO" # # delete "sope-appserver/SoOFS/Version" # # delete "sope-appserver/SoOFS/common.h" # # delete "sope-appserver/SoOFS/fhs.make" # # delete "sope-appserver/SoOFS/product.plist" # # delete "sope-appserver/SoOFS/sope.8" # # delete "sope-appserver/SoOFS/sope.m" # # delete "sope-appserver/WEPrototype" # # delete "sope-appserver/WEPrototype/COPYING" # # delete "sope-appserver/WEPrototype/COPYRIGHT" # # delete "sope-appserver/WEPrototype/ChangeLog" # # delete "sope-appserver/WEPrototype/GNUmakefile" # # delete "sope-appserver/WEPrototype/GNUmakefile.postamble" # # delete "sope-appserver/WEPrototype/GNUmakefile.preamble" # # delete "sope-appserver/WEPrototype/README" # # delete "sope-appserver/WEPrototype/Version" # # delete "sope-appserver/WEPrototype/WELiveLink.m" # # delete "sope-appserver/WEPrototype/WEPrototype-Info.plist" # # delete "sope-appserver/WEPrototype/WEPrototypeBundle.m" # # delete "sope-appserver/WEPrototype/WEPrototypeElemBuilder.m" # # delete "sope-appserver/WEPrototype/WEPrototypeScript.api" # # delete "sope-appserver/WEPrototype/WEPrototypeScript.h" # # delete "sope-appserver/WEPrototype/WEPrototypeScript.jsm" # # delete "sope-appserver/WEPrototype/WEPrototypeScript.m" # # delete "sope-appserver/WEPrototype/WEPrototypeScriptAction.m" # # delete "sope-appserver/WEPrototype/bundle-info.plist" # # delete "sope-appserver/WEPrototype/common.h" # # delete "sope-appserver/WEPrototype/doc" # # delete "sope-appserver/WEPrototype/doc/GNUmakefile" # # delete "sope-appserver/WEPrototype/doc/WEPrototypeScript.3" # # delete "sope-appserver/WEPrototype/fhs.make" # # delete "sope-appserver/WEPrototype/js2m.sh" # # delete "sope-appserver/WEPrototype/prototype" # # delete "sope-appserver/WEPrototype/prototype/AUTHORS" # # delete "sope-appserver/WEPrototype/prototype/LICENSE" # # delete "sope-appserver/WEPrototype/prototype/README" # # delete "sope-appserver/WEPrototype/prototype/THANKS" # # delete "sope-appserver/WEPrototype/prototype/prototype.js" # # delete "sope-appserver/WEPrototype/scriptaculous" # # delete "sope-appserver/WEPrototype/scriptaculous/CHANGELOG" # # delete "sope-appserver/WEPrototype/scriptaculous/MIT-LICENSE" # # delete "sope-appserver/WEPrototype/scriptaculous/README" # # delete "sope-appserver/WEPrototype/scriptaculous/controls.js" # # delete "sope-appserver/WEPrototype/scriptaculous/dragdrop.js" # # delete "sope-appserver/WEPrototype/scriptaculous/effects.js" # # delete "sope-appserver/WOXML" # # delete "sope-appserver/WOXML/COPYING" # # delete "sope-appserver/WOXML/COPYRIGHT" # # delete "sope-appserver/WOXML/ChangeLog" # # delete "sope-appserver/WOXML/GNUmakefile" # # delete "sope-appserver/WOXML/GNUmakefile.preamble" # # delete "sope-appserver/WOXML/README" # # delete "sope-appserver/WOXML/Version" # # delete "sope-appserver/WOXML/WOXML-Info.plist" # # delete "sope-appserver/WOXML/WOXML.h" # # delete "sope-appserver/WOXML/WOXMLDecoder.h" # # delete "sope-appserver/WOXML/WOXMLDecoder.m" # # delete "sope-appserver/WOXML/WOXMLMapDecoder.h" # # delete "sope-appserver/WOXML/WOXMLMapDecoder.m" # # delete "sope-appserver/WOXML/WOXMLMappingEntity.h" # # delete "sope-appserver/WOXML/WOXMLMappingEntity.m" # # delete "sope-appserver/WOXML/WOXMLMappingModel.h" # # delete "sope-appserver/WOXML/WOXMLMappingModel.m" # # delete "sope-appserver/WOXML/WOXMLMappingProperty.h" # # delete "sope-appserver/WOXML/WOXMLMappingProperty.m" # # delete "sope-appserver/WOXML/WOXMLSaxModelHandler.h" # # delete "sope-appserver/WOXML/WOXMLSaxModelHandler.m" # # delete "sope-appserver/WOXML/common.h" # # delete "sope-appserver/WOXML/fhs.make" # # delete "sope-core/NGExtensions/NGExtensions/NGObjCRuntime.h" # # delete "sope-core/NGExtensions/NGObjCRuntime.m" # # delete "sope-core/PROJECTLEAD" # # delete "sope-xml/PROJECTLEAD" # # patch "ChangeLog" # from [8eefb416ac4e53ccbf4214926a37e127d74f5d20] # to [e53079b05035e5f911bd48d753315ac44fbd6205] # # patch "sope-appserver/GNUmakefile" # from [fe0074d994a985f8189ca82aaccc986e1b213b66] # to [594adbae678e103ad312925e2e763cdc28d88b40] # # patch "sope-appserver/NGObjWeb/Associations/WOKeyPathAssociation.m" # from [87b62cf70bb458c8e1681cdd4284d282ac0c06e6] # to [6f43511fdb20bb065e9e787c77070ab9cb2dc76e] # # patch "sope-appserver/NGObjWeb/DynamicElements/WOComponentContent.m" # from [fd4d314518084f4e2d7558a58814187ca44999b0] # to [533a4a0b97a6336e13d02989c6fb4a23c2b24f9b] # # patch "sope-appserver/NGObjWeb/DynamicElements/WOCompoundElement.m" # from [efc8217f3889e32c88076178765dc4d1b24ff192] # to [d48af17bf652c81acd850ad9b1233f3d0beb18bb] # # patch "sope-appserver/NGObjWeb/DynamicElements/decommon.h" # from [46154cf9b423a1c72200d550f5e42e15fe71ee2f] # to [4a3a82fc849fcc1c2249f5485499b84b1afdafcc] # # patch "sope-appserver/NGObjWeb/NSObject+WO.m" # from [3f98a1b027149562bae41a22a541a29781a702e1] # to [789d7b5f193b93767a300bac82b35df83e2fd20c] # # patch "sope-appserver/NGObjWeb/SoObjects/GNUmakefile" # from [8837e704562695b3f47fbfdc2fcb5e6e66c971dc] # to [dd1e8cea5cdb5208e1af5a09a1c42357dffa5557] # # patch "sope-appserver/NGObjWeb/SoObjects/SoObjCClass.m" # from [8a606325a7f6d4d369fefc9d7f91310eaa4552be] # to [3945892148804a9cd79fdd5544462b6ab710ec36] # # patch "sope-appserver/NGObjWeb/SoObjects/SoSelectorInvocation.m" # from [7a287d0740f87fc04d369103944eb6fccd0061ab] # to [b3939614dee42b4e061b53e815b2716425b8c337] # # patch "sope-appserver/NGObjWeb/WOApplication.m" # from [a3806fabb80ca2490edecc510ba3b1846ba766b9] # to [01ed97099e592b60adccb66f2bb27dce4a078309] # # patch "sope-appserver/NGObjWeb/WOComponent+Sync.m" # from [f1d70eb315458eccdf911605dbad7aa0303a213a] # to [8289c302efc35c56ac2f94900d2416a10d0c96fa] # # patch "sope-appserver/NGObjWeb/WODirectActionRequestHandler.m" # from [560bd7b9efa333ed99593447e81264c69390543d] # to [5edbc5a0363aa505cb27460ca61c5ca128d532b2] # # patch "sope-appserver/NGObjWeb/WOSession.m" # from [16ab31716ea4882f476b20544674ef055d85d937] # to [2838dafb7c9f02ee141033403c30d4f829abe7e6] # # patch "sope-appserver/NGObjWeb/common.h" # from [66069d9fe904f3f5af9276b0f95edfddc9777b58] # to [423c43f051d29f0470ad4445abbf2ebe6b3979a1] # # patch "sope-core/EOControl/EOKeyValueCoding.m" # from [bba69aff42bf2cfe351e9f80ec3b6b14ce8bd35a] # to [d767115c5d13fb624c1539a494784e306e50cabf] # # patch "sope-core/EOControl/EOValidation.m" # from [04000f0ed6c6e9ded5250c01ee6ea098241b5209] # to [ede5fb08ebc5632ee82f623db062870e065b9b80] # # patch "sope-core/NGExtensions/EOExt.subproj/EOQualifier+CtxEval.m" # from [3381d0eff8fa5a6eba3643768f74e22913fdafb7] # to [3e1ff61981b7b80fb4accdecfeaac668f32072d7] # # patch "sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m" # from [f466960bd8081b8971bb16a221bfcbc348604096] # to [53462c1d9ee5ecb4c97c13e24025a978deb77f78] # # patch "sope-core/NGExtensions/GNUmakefile" # from [8dd7a334c7b73672ff38ff8be84923149b843ddb] # to [2c182470b4121f06dcbc929696431eef65a7060a] # # patch "sope-core/NGExtensions/NGBundleManager.m" # from [f97319022fb34cab745941d579d97800dd174feb] # to [afdb978b26102d2324760ad3249682c65e823172] # # patch "sope-core/NGExtensions/NGExtensions/NGMemoryAllocation.h" # from [a31672ff89829a2c2c04db50365765b613386015] # to [8eb6eb8e3bc0fcce9b21576022c1d85887f6af3e] # # patch "sope-core/NGExtensions/common.h" # from [c7c29acc9cd3927149f595438f2666dfa2252814] # to [819ac09f20d4c77e1f9bdcf21e2bf9368d59a8ba] # # patch "sope-core/NGStreams/NGConcreteStreamFileHandle.m" # from [7acc98f9176b583bbbea1fb779d8a72e22996c8c] # to [dcdb0d9d9c00888298d45d62f1a5e4c4c4ba08bd] # # patch "sope-core/NGStreams/common.h" # from [d5ec051b757107643a3e9a84ab40071412e9a4a1] # to [6b3c6a2bb8aa5769aa7672be129daa8d958deed1] # # patch "sope-gdl1/GDLAccess/EODatabaseFault.m" # from [cbed5c05d66f16f9836a66c3bcf941abfccd98fb] # to [39a385b41e25a05b2c6de3db4812b695f0246db9] # # patch "sope-gdl1/GDLAccess/EOFault.m" # from [653f0d9bb856121471340b41842a46bdc5239bde] # to [48205793ddd1c54063e556c73bfe296bb5e08ab4] # # patch "sope-gdl1/GDLAccess/EOFaultHandler.m" # from [baa23bb8c785795617aa4229d4905ea70134d9a2] # to [2e2b559fdca27b14229dbe71a0b27d7f49a2bec9] # # patch "sope-gdl1/GDLAccess/EORecordDictionary.m" # from [907d584d5417e00846b65684b034cb1501eadc41] # to [e3f92f26a9a7773ef40d641b1de8623f911da1a1] # # patch "sope-gdl1/MySQL/NSString+MySQL4.m" # from [b0b35c8cf5110155c962aad827e71e83673b0cdf] # to [270f30168958bf5ae05d8c125d58ee1a309a96e0] # # patch "sope-gdl1/MySQL/common.h" # from [b1246826f15a7cda0b62dc019a9eb78f31100af9] # to [c1654dc67d3a84cf80b1b32ad6bf3dea4c735ec8] # # patch "sope-gdl1/PostgreSQL/NSString+PostgreSQL72.m" # from [088585138a050cf18c0bcf77787c15910ba3b227] # to [956f0d45aef537a11b0bacff9c15fde2c40d438b] # # patch "sope-gdl1/PostgreSQL/common.h" # from [888b0f01c640da66229d2c076600ae8e21103a5b] # to [dc9618421c17ede0dac292a84d593df6b42af914] # ============================================================ --- sope-appserver/GNUmakefile fe0074d994a985f8189ca82aaccc986e1b213b66 +++ sope-appserver/GNUmakefile 594adbae678e103ad312925e2e763cdc28d88b40 @@ -9,11 +9,7 @@ SUBPROJECTS += \ SUBPROJECTS += \ NGObjWeb \ WEExtensions \ - WOExtensions \ - WOXML \ - SoOFS \ - NGXmlRpc \ - WEPrototype + WOExtensions ifeq ($(frameworks),yes) ============================================================ --- sope-appserver/NGObjWeb/Associations/WOKeyPathAssociation.m 87b62cf70bb458c8e1681cdd4284d282ac0c06e6 +++ sope-appserver/NGObjWeb/Associations/WOKeyPathAssociation.m 6f43511fdb20bb065e9e787c77070ab9cb2dc76e @@ -25,22 +25,29 @@ #include "common.h" #include -#if LIB_FOUNDATION_BOEHM_GC -# if LIB_FOUNDATION_LIBRARY -# include -# else -# error no BoehmGC support on this Foundation! -# endif +#if __GNU_LIBOBJC__ == 20100911 +#define METHOD_NULL NULL +#define object_is_instance(XXX) (XXX != nil) +#define class_get_class_method class_getClassMethod +#define class_get_instance_method class_getInstanceMethod +#define sel_get_uid sel_getUid +#define method_get_imp method_getImplementation +typedef struct objc_method *Method_t; + #endif -#if NeXT_RUNTIME || APPLE_RUNTIME +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) # include # include +# define object_is_instance(XXX) (XXX != nil) +#if defined(APPLE_RUNTIME) # include +# define object_is_instance(XXX) \ + ((XXX != nil) && CLS_ISCLASS(*((Class *)XXX))) +#endif +#define method_get_imp method_getImplementation # define METHOD_NULL NULL -# define object_is_instance(XXX) \ - ((XXX != nil) && CLS_ISCLASS(*((Class *)XXX))) # define sel_get_uid sel_getUid # define class_get_class_method class_getClassMethod # define class_get_instance_method class_getInstanceMethod @@ -385,8 +392,8 @@ static inline void _fillInfo(WOKeyPathAs return; { -#if NeXT_RUNTIME - struct objc_method *method = NULL; +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + struct objc_method *method = NULL; #else Method_t method = METHOD_NULL; #endif @@ -471,12 +478,8 @@ static inline void _fillInfo(WOKeyPathAs info->isFault = [object isFault]; if (method != METHOD_NULL) { -#if NeXT_RUNTIME - info->access.method = method->method_imp; -#else info->access.method = method_get_imp(method); -#endif - info->retType = *(method->method_types); + info->retType = *(method_getTypeEncoding(method)); } #if HEAVY_DEBUG ============================================================ --- sope-appserver/NGObjWeb/DynamicElements/WOComponentContent.m fd4d314518084f4e2d7558a58814187ca44999b0 +++ sope-appserver/NGObjWeb/DynamicElements/WOComponentContent.m 533a4a0b97a6336e13d02989c6fb4a23c2b24f9b @@ -75,7 +75,7 @@ static Class NSDateClass = Nil; printf(" "); printf("content: [%s %s]: %0.3fs\n", [[component name] cString], -#if APPLE_RUNTIME || NeXT_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) sel_getName(_cmd), #else sel_get_name(_cmd), @@ -115,7 +115,7 @@ static Class NSDateClass = Nil; printf(" "); printf("content: [%s %s]: %0.3fs\n", [[component name] cString], -#if APPLE_RUNTIME || NeXT_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) sel_getName(_cmd), #else sel_get_name(_cmd), @@ -165,7 +165,7 @@ static Class NSDateClass = Nil; printf(" "); printf("content: [%s %s]: %0.3fs\n", [[component name] cString], -#if APPLE_RUNTIME || NeXT_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) sel_getName(_cmd), #else sel_get_name(_cmd), ============================================================ --- sope-appserver/NGObjWeb/DynamicElements/WOCompoundElement.m efc8217f3889e32c88076178765dc4d1b24ff192 +++ sope-appserver/NGObjWeb/DynamicElements/WOCompoundElement.m d48af17bf652c81acd850ad9b1233f3d0beb18bb @@ -262,8 +262,12 @@ static int descriptiveIDs = -1; printf(" "); #endif printf(" Child of 0x%p: i[%i] %s <%s>: %0.3fs\n", +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + self, i, [[_ctx elementID] cString], class_getName([child class]), +#else self, i, [[_ctx elementID] cString], [child class]->name, - diff); +#endif + diff); } } if (logId) { ============================================================ --- sope-appserver/NGObjWeb/DynamicElements/decommon.h 46154cf9b423a1c72200d550f5e42e15fe71ee2f +++ sope-appserver/NGObjWeb/DynamicElements/decommon.h 4a3a82fc849fcc1c2249f5485499b84b1afdafcc @@ -22,7 +22,6 @@ #ifndef __NGObjWeb_DynElem_common_H__ #define __NGObjWeb_DynElem_common_H__ -#include #import #if !LIB_FOUNDATION_LIBRARY && !GNUSTEP_BASE_LIBRARY ============================================================ --- sope-appserver/NGObjWeb/NSObject+WO.m 3f98a1b027149562bae41a22a541a29781a702e1 +++ sope-appserver/NGObjWeb/NSObject+WO.m 789d7b5f193b93767a300bac82b35df83e2fd20c @@ -131,7 +131,7 @@ static inline SEL _getSetSel(register co register unsigned _len) { char buf[259]; _getSetSelName((unsigned char *)buf, _key, _len); -#if APPLE_RUNTIME || NeXT_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) return sel_getUid(buf); #else return sel_get_uid(buf); @@ -259,7 +259,7 @@ IMP WOGetKVCGetMethod(id object, NSStrin if (object == nil) return NULL; if (_key == nil) return NULL; -#if GNU_RUNTIME +#if GNU_RUNTIME && !(defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) { unsigned keyLen; char *buf; @@ -308,7 +308,7 @@ id WOGetKVCValueUsingMethod(id object, N char *buf; buf = malloc(keyLen + 1); [_key getCString:buf]; -#if APPLE_RUNTIME || NeXT_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) getSel = sel_getUid(buf); #else getSel = sel_get_uid(buf); ============================================================ --- sope-appserver/NGObjWeb/SoObjects/GNUmakefile 8837e704562695b3f47fbfdc2fcb5e6e66c971dc +++ sope-appserver/NGObjWeb/SoObjects/GNUmakefile dd1e8cea5cdb5208e1af5a09a1c42357dffa5557 @@ -57,7 +57,6 @@ SoObjects_OBJC_FILES = \ SoObject.m \ SoObjectMethodDispatcher.m \ SoObjectRequestHandler.m \ - SoObjectXmlRpcDispatcher.m \ SoObjectSOAPDispatcher.m \ SoPageInvocation.m \ SoActionInvocation.m \ ============================================================ --- sope-appserver/NGObjWeb/SoObjects/SoObjCClass.m 8a606325a7f6d4d369fefc9d7f91310eaa4552be +++ sope-appserver/NGObjWeb/SoObjects/SoObjCClass.m 3945892148804a9cd79fdd5544462b6ab710ec36 @@ -21,7 +21,6 @@ #include "SoObjCClass.h" #include "SoSelectorInvocation.h" -#include #include #include "common.h" @@ -38,6 +37,39 @@ return [self initWithSoSuperClass:_soClass class:nil]; } +- (NSEnumerator *) _methodsFromClass: (Class) c { + NSMutableArray *a; + int i; + + a = [NSMutableArray array]; + +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + Method *p, *m; + int count; + + p = m = class_copyMethodList(c, &count); + + for (i = 0; i < count; i++) { + [a addObject: NSStringFromSelector(method_getName(*m))]; + m++ + } + + free(p); +#else + struct objc_method_list *methods; + Method method; + for (methods = c->methods; methods != NULL; methods = methods->method_next) { + for (i = 0; i < methods->method_count; i++) { + method = &(methods->method_list[i]); + [a addObject: NSStringFromSelector(method->method_name)]; + } + } + +#endif + + return [a objectEnumerator]; +} + - (void)rescanClass { NSMutableDictionary *prefixMap; NSEnumerator *e; @@ -47,7 +79,7 @@ [self debugWithFormat:@"scanning ObjC class %@ for SoObject methods ...", NSStringFromClass(self->clazz)]; - e = [self->clazz methodNameEnumerator]; + e = [self _methodsFromClass: self->clazz]; while ((methodName = [e nextObject])) { SoSelectorInvocation *invocation; NSString *methodPrefix; ============================================================ --- sope-appserver/NGObjWeb/SoObjects/SoObjectXmlRpcDispatcher.h 26b2ca0b6c8f8f3f3a18d1bb69860edcb347788d +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoObjects_SoObjectXmlRpcDispatcher_H__ -#define __SoObjects_SoObjectXmlRpcDispatcher_H__ - -#include "SoObjectMethodDispatcher.h" - -/* - SoObjectXmlRpcDispatcher - - A specialized variant of the method dispatcher that deals with XML-RPC - method invocations. -*/ - -@interface SoObjectXmlRpcDispatcher : SoObjectMethodDispatcher -@end - -#endif /* __SoObjects_SoObjectXmlRpcDispatcher_H__ */ ============================================================ --- sope-appserver/NGObjWeb/SoObjects/SoObjectXmlRpcDispatcher.m 6d506611c46582499167eb53db85326da8204e26 +++ /dev/null @@ -1,327 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "SoObjectXmlRpcDispatcher.h" -#include "SoObject.h" -#include "SoClass.h" -#include "NSException+HTTP.h" -#include -#include -#include -#include -#include -#include "common.h" - -@interface NSObject(XmlRpcCall) - -- (id)callOnObject:(id)_client - withPositionalParameters:(NSArray *)_args - inContext:(id)_ctx; - -@end - -@implementation SoObjectXmlRpcDispatcher - -static BOOL debugOn = NO; - -+ (void)initialize { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - - debugOn = [ud boolForKey:@"SoObjectXmlRpcDispatcherDebugEnabled"]; - if (debugOn) NSLog(@"Note: SOPE XML-RPC Dispatcher Debugging turned on."); -} - -/* error handling */ - -- (NSException *)missingMethodFault:(NSString *)_method - inContext:(WOContext *)_ctx -{ - NSString *r; - - r = [@"Could not locate requested XML-RPC method: " - stringByAppendingString:_method]; - return [NSException exceptionWithHTTPStatus:404 /* not found */ - reason:r]; -} - -/* perform call on object */ - -- (BOOL)isPackagePathMethodName:(NSString *)_name inContext:(WOContext *)_ctx { - /* - If the XML-RPC method name contains a dot (eg system.listmethods), we need - to check whether the namespace is to be treated as a path or whether we - should lookup the fully qualified name. - - So we first check whether it contains a dot, then we check whether the - object implements the fully qualified name. Otherwise we treat the - namespace as a path. - */ - NSRange r; - - /* check whether the name contains a dot ... */ - - r = [_name rangeOfString:@"." options:(NSLiteralSearch|NSBackwardsSearch)]; - if (r.length == 0) - return NO; /* no dot ... */ - - /* check whether the object implements the fully qualified name */ - - if ([self->object hasName:_name inContext:_ctx]) - return NO; - - [self debugWithFormat: - @"Note: did not find pkg name '%@' in %@", _name, self->object]; - - /* otherwise, perform a path lookup ... */ - return YES; -} - -- (NSException *)getClientObject:(id *)_object andMethodName:(NSString **)_mn - forPackageMethodPath:(NSString *)_path inContext:(WOContext *)_ctx -{ - /* has a prefix, eg "folder.folder.a()" => traverse */ - NSArray *nsParts; - NSException *error = nil; - unsigned count; - - nsParts = [_path componentsSeparatedByString:@"."]; - count = [nsParts count]; - *_mn = [[[nsParts objectAtIndex:(count - 1)] copy] autorelease]; - nsParts = [nsParts subarrayWithRange:NSMakeRange(0, count - 1)]; - - [self debugWithFormat:@"XML-RPC traversal: %@", - [nsParts componentsJoinedByString:@" => "]]; - - /* - TODO: we might not want to use -traverse.. so that the clientObject - stays the same (the one bound to the URL)? - */ - *_object = [self->object - traversePathArray:nsParts inContext:_ctx error:&error - acquire:YES]; - return error; -} - -- (id)performActionNamed:(NSString *)_name parameters:(NSArray *)_params - inContext:(WOContext *)_ctx -{ - NSString *methodName; - id clientObject; - id method; - - // TODO: check whether _name is set - - [self debugWithFormat:@"should perform: %@", _name]; - methodName = nil; - - if ([self isPackagePathMethodName:_name inContext:_ctx]) { - /* has a prefix, eg "folder.folder.a()" => traverse */ - NSException *error = nil; - - [self debugWithFormat:@"Note: traversing path to XML-RPC method: %@", - _name]; - - error = [self getClientObject:&clientObject andMethodName:&methodName - forPackageMethodPath:_name inContext:_ctx]; - if (error) { - [self debugWithFormat:@" XML-RPC traversal error: %@", error]; - return error; - } - } - else { - clientObject = self->object; - methodName = _name; - } - - method = [clientObject lookupName:methodName inContext:_ctx acquire:YES]; - if (method == nil) { - // TODO: return proper fault! - [self logWithFormat:@"did not find requested XML-RPC method: '%@'", - methodName]; - return [self missingMethodFault:methodName inContext:_ctx]; - } - if (![method isCallable]) { - // TODO: return proper fault! - [self logWithFormat: - @"located object (%@) is not callable (class=%@):\n %@", - methodName, NSStringFromClass([method class]), method]; - return nil; - } - - /* TODO: do we need to bind or is this automatic? */ - - if ([method respondsToSelector: - @selector(callOnObject:withPositionalParameters:inContext:)]) { - [self debugWithFormat: - @"calling XML-RPC method with %i positional parameters.", - [_params count]]; - return [method callOnObject:clientObject - withPositionalParameters:_params - inContext:_ctx]; - } - - if ([_params count] > 0) { - [self warnWithFormat: - @"invoking SOPE method via XML-RPC without " - @"positional paramters (%i parameters defined): %@", - [_params count], method]; - } - return [method callOnObject:clientObject inContext:_ctx]; -} - -- (id)faultFromException:(NSException *)_exception - methodCall:(XmlRpcMethodCall *)_call -{ -#if !APPLE_FOUNDATION_LIBRARY && !NeXT_Foundation_LIBRARY - /* add some more information to generic exceptions ... */ - if (_call != nil) { - NSMutableDictionary *ui; - - ui = [[_exception userInfo] mutableCopy]; - if (ui == nil) ui = [[NSMutableDictionary alloc] init]; - - [ui setObject:[_call methodName] forKey:@"methodName"]; - [ui setObject:[_call parameters] forKey:@"methodParameters"]; - - [_exception setUserInfo:ui]; - [ui release]; - } -#endif - - [self logWithFormat:@"%s: turning exception into fault %@\n", - __PRETTY_FUNCTION__, - [_exception description]]; - - return _exception; -} - -- (id)actionResponseForResult:(id)resValue { - if ([resValue conformsToProtocol:@protocol(WOActionResults)]) { - /* a "HTTP" result ... */ - return resValue; - } - else { - /* an XML-RPC result ... */ - XmlRpcMethodResponse *mResponse; - - mResponse = [[XmlRpcMethodResponse alloc] initWithResult:resValue]; - return [mResponse autorelease]; - } -} - -- (id)performMethodCall:(XmlRpcMethodCall *)_call inContext:(WOContext *)_ctx{ - id resValue; - - NS_DURING { - resValue = [self performActionNamed:[_call methodName] - parameters:[_call parameters] - inContext:_ctx]; - resValue = [resValue retain]; - } - NS_HANDLER { - resValue = [self faultFromException:localException - methodCall:_call]; - resValue = [resValue retain]; - } - NS_ENDHANDLER; - - resValue = [resValue autorelease]; - - return [self actionResponseForResult:resValue]; -} - -- (id)couldNotDecodeXmlRpcRequestInContext:(WOContext *)_ctx { - WOResponse *r = [_ctx response]; - - [r setStatus:400 /* bad request */]; - [r appendContentString:@"malformed XML-RPC request !"]; - return r; -} - -- (id)handleXmlRpcEncodingException:(NSException *)_exception object:(id)_obj { - [self logWithFormat:@"could not encode object: %@ (%@): %@", - _obj, NSStringFromClass([_obj class]), _exception]; - return nil; -} - -- (id)dispatchInContext:(WOContext *)_ctx { - XmlRpcMethodResponse *r; - XmlRpcMethodCall *call; - id result; - - if (![XmlRpcMethodCall - instancesRespondToSelector:@selector(initWithRequest:)]) { - [self errorWithFormat: - @"XmlRpcMethodCall does not respond to -initWithRequest:, " - @"this method is part of libNGXmlRpc which you might want to link " - @"against to get XML-RPC support."]; - return [NSException exceptionWithHTTPStatus:501 /* Not Implemented */ - reason:@"server does not support XML-RPC"]; - } - - /* decode XML-RPC call */ - - call = [XmlRpcMethodCall alloc]; - call = [call initWithRequest:[_ctx request]]; - call = [call autorelease]; - - if (call == nil) - return [self couldNotDecodeXmlRpcRequestInContext:_ctx]; - - /* perform call */ - - if ((result = [self performMethodCall:call inContext:_ctx]) == nil) - /* TODO: should we return a fault instead? */ - return nil; - - if ([result isKindOfClass:[WOResponse class]]) - /* pass WOResponse objects through ... */ - return result; - - /* encode result as XML-RPC */ - - NS_DURING { - if ([result isKindOfClass:[XmlRpcMethodResponse class]]) - r = result; - else - r = [[[XmlRpcMethodResponse alloc] initWithResult:result] autorelease]; - - result = [[[r generateResponse] retain] autorelease]; - } - NS_HANDLER { - result = [self handleXmlRpcEncodingException:localException - object:result]; - } - NS_ENDHANDLER; - - return result; -} - -/* debugging */ - -- (NSString *)loggingPrefix { - return @"[obj-xmlrpc-dispatch]"; -} -- (BOOL)isDebuggingEnabled { - return debugOn; -} - -@end /* SoObjectXmlRpcDispatcher */ ============================================================ --- sope-appserver/NGObjWeb/SoObjects/SoSelectorInvocation.m 7a287d0740f87fc04d369103944eb6fccd0061ab +++ sope-appserver/NGObjWeb/SoObjects/SoSelectorInvocation.m b3939614dee42b4e061b53e815b2716425b8c337 @@ -28,6 +28,11 @@ #include #include "common.h" +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# define sel_get_any_uid sel_getUid +# define sel_register_name sel_registerName +#endif + @implementation SoSelectorInvocation static BOOL debugOn = NO; ============================================================ --- sope-appserver/NGObjWeb/WOApplication.m a3806fabb80ca2490edecc510ba3b1846ba766b9 +++ sope-appserver/NGObjWeb/WOApplication.m 01ed97099e592b60adccb66f2bb27dce4a078309 @@ -38,7 +38,7 @@ #include "common.h" #include -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) # include #endif ============================================================ --- sope-appserver/NGObjWeb/WOComponent+Sync.m f1d70eb315458eccdf911605dbad7aa0303a213a +++ sope-appserver/NGObjWeb/WOComponent+Sync.m 8289c302efc35c56ac2f94900d2416a10d0c96fa @@ -23,6 +23,12 @@ #include #include "common.h" +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# include +# define class_get_instance_method class_getInstanceMethod +# define method_get_imp method_getImplementation +#endif + @implementation WOComponent(OptimizedSynching) /* ============================================================ --- sope-appserver/NGObjWeb/WODirectActionRequestHandler.m 560bd7b9efa333ed99593447e81264c69390543d +++ sope-appserver/NGObjWeb/WODirectActionRequestHandler.m 5edbc5a0363aa505cb27460ca61c5ca128d532b2 @@ -70,7 +70,7 @@ static Class NSDateClass = Nil; - (BOOL)isComponentClass:(Class)_clazz { if (_clazz == Nil) return NO; - while ((_clazz = _clazz->super_class) != Nil) { + while ((_clazz = class_getSuperclass(_clazz)) != Nil) { if (_clazz == [WOComponent class]) return YES; if (_clazz == [WODirectAction class]) return NO; if (_clazz == [NSObject class]) return NO; ============================================================ --- sope-appserver/NGObjWeb/WOSession.m 16ab31716ea4882f476b20544674ef055d85d937 +++ sope-appserver/NGObjWeb/WOSession.m 2838dafb7c9f02ee141033403c30d4f829abe7e6 @@ -33,6 +33,10 @@ #include "common.h" #include +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# define sel_get_name sel_getName +#endif + #if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY @interface NSObject(Miss) - (id)notImplemented:(SEL)cmd; ============================================================ --- sope-appserver/NGObjWeb/common.h 66069d9fe904f3f5af9276b0f95edfddc9777b58 +++ sope-appserver/NGObjWeb/common.h 423c43f051d29f0470ad4445abbf2ebe6b3979a1 @@ -42,7 +42,7 @@ # include #endif -#include + #import #import #import ============================================================ --- sope-appserver/NGXmlRpc/ChangeLog 86d9d448d766478c0a61650b131fe2db9fdfb5e0 +++ /dev/null @@ -1,333 +0,0 @@ -2007-11-20 Helge Hess - - * NGXmlRpcClient.m: add redirect locations to error reason (v4.7.17) - -2007-02-12 Helge Hess - - * NGXmlRpcClient.m: fixed a gnustep-base compilation warning (v4.7.16) - -2006-07-03 Helge Hess - - * use %p for pointer formats, fixed gcc 4.1 warnings, use -isNotEmpty - when appropriate (v4.5.15) - -2006-05-16 Marcus Mueller - - * *m: changed EOControl related includes into imports - to enable compilation against MulleEOF (v4.5.14) - -2005-09-18 Helge Hess - - * GNUmakefile.preamble: added dependency to NGMail (v4.5.13) - -2005-08-11 Helge Hess - - * GNUmakefile.preamble: added framework compilation for OSX (v4.5.12) - -2005-08-05 Helge Hess - - * WODirectAction+XmlRpc.m: fixed gcc 4.0 warnings (v4.5.11) - -2005-05-03 Helge Hess - - * NGXmlRpcAction.m: fixed gcc 4.0 warnings (v4.5.10) - -2005-01-02 Helge Hess - - * WODirectAction+XmlRpc.m: minor code cleanups (v4.5.9) - -2004-11-11 Marcus Mueller - - * NGXmlRpc.xcode: fixed a subtle bug that prevent Xcode from being - loaded correctly. - -2004-11-07 Marcus Mueller - - * v4.5.8 - - * NGXmlRpc.xcode: new Xcode project - - * common.h: fixed for multiple inclusion during Xcode - build (common.h is the prefix header) - -2004-09-14 Helge Hess - - * moved xmlrpc_call tool to own top-level SOPE dir (xmlrpc_call) - (v4.3.7) - -2004-09-11 Marcus Mueller - - * GNUmakefile.preamble: minor changes for inline compilation with - GNUSTEP_BUILD_DIR set elsewhere (v4.3.6) - -2004-09-10 Helge Hess - - * GNUmakefile: fixed soname, libname versions (v4.3.5) - -2004-08-31 Helge Hess - - * GNUmakefile.preamble: fixed libNGMime location for gstep-make 1.9.2, - fixed library locations for FHS (v4.3.4) - -2004-08-29 Helge Hess - - * added hack to install the project in FHS locations - the library, - its headers, the tools and the resources will be installed in - FHS_INSTALL_ROOT if specified (eg make FHS_INSTALL_ROOT=/usr/local) - (v4.3.3) - -2004-08-23 Helge Hess - - * v4.3.2 - - * xmlrpc_call.m: properly include UnixSignalHandler from NGObjWeb on - non-lF platforms - - * GNUmakefile.preamble: removed libjs linking path - - * moved NGXmlRpc to own subproject (v4.3.1) - -2004-04-17 Marcus Mueller - - * WODirectAction+XmlRpc.m: replaced "catched" with "caught" in comment. - -2004-03-15 Helge Hess - - * EOFetchSpecification+XmlRpcCoding.m: do not use deprecated plist - init method (v4.2.322) - -2004-03-01 Helge Hess - - * NGXmlRpcClient.m: added ability to specify additional, HTTP level - headers to be used when creating the WORequest for the XML-RPC - invocation (v4.2.315) - -2004-02-09 Helge Hess - - * NGXmlRpcClient.m: deprecated non-URL based API, add -login method - (v4.2.289) - -2003-08-26 Helge Hess - - * WODirectAction+XmlRpc.m: small cleanup to exception handling - (v4.2.216) - -2003-01-30 Helge Hess - - * v4.2.138 - - * WODirectAction+XmlRpc.m: added special handling for NULL selectors, - since the MacOSX Foundation does not allow -respondsToSelector:NULL - - * NSObject+Reflection.m: added reflection for Apple runtime (required - by system.listMethods) - - * NGXmlRpcRequestHandler.m: replaced some release macros - -2003-01-29 Helge Hess - - * WODirectAction+XmlRpcIntrospection.m: added patch provided by Bjoern - (fixes SKYRiX bug 918) - -2003-01-16 Helge Hess - - * WODirectAction+XmlRpc.m: fixed a bug (incorrect number of arguments - passed to a selector) - -2003-01-09 Helge Hess - - * NGXmlRpcClient.m: started support for HTTP digest authentication - (v4.2.112) - -Mon Dec 23 15:47:38 2002 Helge Hess - - * WODirectAction+XmlRpc.m: fixed a gcc 3.2 warning (v4.2.103) - -2002-10-04 Helge Hess - - * removed the change below (v4.2.38) :-( - - * NGXmlRpcAction+Registry.m: use -skyDictionaryWithContentsOfFile: - for parsing of property lists (so that comments work on OSX) - (v4.2.37) - -2002-08-29 Helge Hess - - * NGXmlRpcRequestHandler.m: small fix to make gcc 3.1 happy (v4.2.35) - -2002-07-02 Helge Hess - - * NGXmlRpcAction.m: fixed a bug in auth handling (www-authenticate - header was not set, if access was denied) - - allow an action selector to have more arguments than the associated - signature (the remaining args are filled with nil ...) - -2002-06-27 Helge Hess - - * NGXmlRpcAction+Registry.m: added a default to control the logging of - selector<->rpc-method mapping - -2002-06-20 Helge Hess - - * XmlRpcMethodResponse+WO.m: changed back to use WOResponse - content encoding - -Wed Jun 19 18:53:49 2002 Bjoern Stierand - - * XmlRpcMethodResponse+WO.m: changed default response - encoding to UTF-8 (was defaultCStringEncoding before) - -Fri May 10 15:29:14 2002 Helge Hess - - * NGXmlRpcAction.m: improved error handling - - * NGXmlRpcClient.m: improved error handling - -Sun May 5 14:27:12 2002 Helge Hess - - * moved as a subproject to NGObjWeb - -Mon Apr 22 13:34:44 2002 Helge Hess - - * GNUmakefile: always build xmlrpc_call - -Fri Apr 12 14:35:30 2002 Helge Hess - - * NGXmlRpcAction.m: added ability to coredump if a fault is going - to be delivered - -Tue Apr 9 15:19:13 2002 Bjoern Stierand - - * NGXmlRpcClient.m: fixed adding of authorization to headers - even if no username/password was set - -Fri Apr 5 15:20:47 2002 Helge Hess - - * WODirectAction+XmlRpc.m ([WODirectAction -selectorForXmlRpcAction:parameters:]): - don't print warning if system.* methods are invoked - -Tue Mar 26 19:26:15 2002 Bjoern Stierand - - * added xmlrpc_call tool - -Mon Mar 25 16:54:20 2002 Helge Hess - - * added NGXmlRpcRequestHandler, NGXmlRpcAction, NGAsyncResultProxy - from SkyDaemon - -Fri Mar 15 15:29:31 2002 Helge Hess - - * XmlRpcMethodResponse+WO.m: set content-type to text/xml - -Mon Mar 11 18:09:54 2002 Helge Hess - - * XmlRpcMethodResponse+WO.h: conforms to WOActionResults - -Tue Feb 26 18:27:37 2002 Bjoern Stierand - - * WODirectAction+XmlRpcIntrospection.m: component namespace - is now added for all functions who are not introspection methods - -Thu Feb 14 11:09:19 2002 Helge Hess - - * EOFetchSpecification+XmlRpcCoding.m: use EOQualifier to decode - a property list parameter - -Wed Feb 13 13:52:09 2002 Helge Hess - - * moved generic stuff to XML/XmlRpc - -Sat Feb 9 13:00:11 2002 Helge Hess - - * XmlRpcSaxHandler.m: added warning and error handlers ... - - * XmlRpcDecoder.m: improved error output - -Fri Feb 8 17:35:05 2002 Helge Hess - - * XmlRpcDecoder.m: fixed charset problems - - * WODirectAction+XmlRpcIntrospection.m: changed to return "string" - signature for object types - -Thu Feb 7 20:19:55 2002 Helge Hess - - * WODirectAction+XmlRpc.m: autogenerate SandStorm component name - -Wed Jan 30 18:16:31 2002 Helge Hess - - * WODirectAction+XmlRpcIntrospection.m: fixed bug with method names - - * NGXmlRpcInvocation.m: convert types prior to call, if signature - is available - -Tue Jan 29 18:30:56 2002 Helge Hess - - * added NGXmlRpcInvocation, NGXmlRpcMethodSignature - -Mon Jan 28 18:46:34 2002 Helge Hess - - * WODirectAction+XmlRpc.m: improved reflection capabilities - - * WODirectAction+XmlRpc.m: support a GET action for dynamic reflection - - * WODirectAction+XmlRpc.m: added method to define component prefix - -Fri Jan 25 18:36:58 2002 Helge Hess - - * WODirectAction+XmlRpc.m: use RPC2 as action name ... - - * added NGXmlRpcClient class - -Thu Jan 17 17:23:09 2002 Martin Spindler - - * NSObject+XmlRpc.m: raise exception if coding methods arn't supported - -Tue Nov 13 09:34:54 2001 Helge Hess - - * EOKeyGlobalID+XmlRpcCoding.m: removed unnecessary retain/autorelease - -Tue Nov 13 01:06:50 2001 Jan Reichmann - - * EOKeyGlobalID+XmlRpcCoding.m: fixed decoding bug - -Wed Oct 24 13:23:54 2001 Martin Spindler - - * XmlRpcSaxHandler.m: fixed multiple call of -characters:length: - -Mon Oct 22 20:53:33 2001 Helge Hess - - * XmlRpcEncoder.m: normalize NSString subclasses - - * XmlRpcMethodResponse+WO.m: enabled UTF-8 for result encoding - -Wed Oct 10 19:42:17 2001 Martin Spindler - - * XmlRpcEncoder.m: use -classForCoder instead of -class - -Tue Aug 28 15:38:05 2001 Martin Spindler - - * changed 'timeZone' - tag into 'timeZone' - attribute - - * support of 'timeZone' - tag (not xmlprc compatible!) - - * XmlRpcCoder: added accessors for defaultTimeZone - -Mon Aug 27 10:47:03 2001 Helge Hess - - * moved SKYRiX Logic categories back to skyxmlrpcd - -Wed Aug 22 15:41:39 2001 Helge Hess - - * XmlRpcDecoder.m: decode dates as calendar-dates - - * use ObjC base-types for decoding/encoding numbers - - * NSDate+XmlRpcCoding.m: fixed NSTimeZone decoding - - * NSArray+XmlRpcCoding.m: fixed NSEnumerator coding, fixed RC bugs - -Mon Aug 20 21:55:41 2001 Helge Hess - - * created ChangeLog - ============================================================ --- sope-appserver/NGXmlRpc/EOFetchSpecification+XmlRpcCoding.m 2a7edda29f5bc1269029105b9aad56d28be0909d +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#import -#include "common.h" -#include -#import - -@implementation EOFetchSpecification(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - if ((self = [super init])) { - id q; - - [self setUsesDistinct:[_coder decodeBooleanForKey:@"usesDistinct"]]; - [self setLocksObjects:[_coder decodeBooleanForKey:@"locksObjects"]]; - [self setEntityName: [_coder decodeStringForKey:@"entityName"]]; - [self setFetchLimit: [_coder decodeIntForKey:@"fetchLimit"]]; - [self setHints: [_coder decodeStructForKey:@"hints"]]; - - if ((q = [_coder decodeObjectForKey:@"qualifier"])) { - if ([q isKindOfClass:[EOQualifier class]]) - /* already a qualifier :-) [ObjC on the other side ..] */ - [q retain]; - else { - q = [[EOQualifier alloc] initWithPropertyList:q owner:nil]; - } - } - - [self setQualifier:q]; - [self setSortOrderings:[_coder decodeObjectForKey:@"sortOrderings"]]; - - [q release]; - } - return self; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeBoolean:[self usesDistinct] forKey:@"usesDistinct"]; - [_coder encodeBoolean:[self locksObjects] forKey:@"locksObjects"]; - [_coder encodeString:[self entityName] forKey:@"entityName"]; - [_coder encodeInt:[self fetchLimit] forKey:@"fetchLimit"]; - [_coder encodeStruct:[self hints] forKey:@"hints"]; - [_coder encodeObject:[self qualifier] forKey:@"qualifier"]; - [_coder encodeObject:[self sortOrderings] forKey:@"sortOrderings"]; -} - -@end /* EOFetchSpecification(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/EOKeyGlobalID+XmlRpcCoding.m 376493abad7c50ea32711b9437365b9b1de95ee0 +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#include "common.h" -#include - -@implementation EOKeyGlobalID(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - EOKeyGlobalID *globalID; - NSString *name; - NSArray *keyVals; - int i, cnt; - id *vals; - - name = [_coder decodeStringForKey:@"entityName"]; - keyVals = [_coder decodeArrayForKey:@"keyValues"]; - cnt = [keyVals count]; - - vals = calloc(cnt, sizeof(id)); - - for (i = 0; i < cnt; i++) - vals[i] = [keyVals objectAtIndex:i]; - - globalID = [EOKeyGlobalID globalIDWithEntityName:name - keys:vals - keyCount:cnt - zone:[self zone]]; - - free(vals); vals = NULL; - - [self release]; - return [globalID retain]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self entityName] forKey:@"entityName"]; - [_coder encodeArray:[self keyValuesArray] forKey:@"keyValues"]; -} - -@end /* EOKeyGlobalID(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/EONull+XmlRpcCoding.m d60a8a7915fc0f24e07c45a53da3c2674e257aeb +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#include "common.h" -#include - -@implementation EONull(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - return [[NSNull null] retain]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:@""]; -} - -@end /* EONull(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/EOQualifier+XmlRpcCoding.m 40fbbf7131f738e48d8802a43fe7b79356fcb027 +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#include "common.h" -#include - -#if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY -@interface NSObject(Miss) -- (void)subclassResponsibility:(SEL)cmd; -@end -#endif - -@implementation EOQualifier(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - // TODO: hh asks: whats that ? - return [self init]; -} -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [self subclassResponsibility:_cmd]; -} - -@end /* EOQualifier */ - -@implementation EOAndQualifier(XmlRpcCoding) -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"]; - - return [self initWithQualifierArray:quals]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"]; -} - -@end /* EOAndQualifier(XmlRpcCoding) */ - -@implementation EOOrQualifier(XmlRpcCoding) -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"]; - - return [self initWithQualifierArray:quals]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"]; -} - -@end /* EOOrQualifier(XmlRpcCoding) */ - -@implementation EONotQualifier(XmlRpcCoding) -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - return [self initWithQualifier:[_coder decodeObject]]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeObject:[self qualifier]]; -} - -@end /* EONotQualifier(XmlRpcCoding) */ - -@implementation EOKeyValueQualifier(XmlRpcCoding) -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - NSString *k = nil; - id val = nil; - SEL sel = NULL; - - k = [_coder decodeStringForKey:@"selector"]; - if (k) sel = NSSelectorFromString(k); - val = [_coder decodeObjectForKey:@"value"]; - k = [_coder decodeStringForKey:@"key"]; - - return [self initWithKey:k operatorSelector:sel value:val]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self key] forKey:@"key"]; - [_coder encodeObject:[self value] forKey:@"value"]; - [_coder encodeString:NSStringFromSelector([self selector]) - forKey:@"selector"]; -} - -@end /* EOKeyValueQualifier(XmlRpcCoding) */ - -@implementation EOKeyComparisonQualifier(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - NSString *lKey = nil; - NSString *rKey = nil; - SEL sel = NULL; - - lKey = [_coder decodeStringForKey:@"selector"]; - if (lKey) sel = NSSelectorFromString(lKey); - lKey = [_coder decodeObjectForKey:@"leftKey"]; - rKey = [_coder decodeStringForKey:@"rightKey"]; - - return [self initWithLeftKey:lKey operatorSelector:sel rightKey:rKey]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self leftKey] forKey:@"leftKey"]; - [_coder encodeObject:[self rightKey] forKey:@"rightKey"]; - [_coder encodeString:NSStringFromSelector([self selector]) - forKey:@"selector"]; -} - -@end /* EOKeyComparisonQualifier(XmlRpcCoding) */ - -#ifdef MULLE_EO_CONTROL -#warning !! EOQualifierVariable still private? -#else -@implementation EOQualifierVariable(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - return [self initWithKey:[_coder decodeString]]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self key]]; -} - -@end /* EOQualifierVariable(XmlRpcCoding) */ -#endif /* MULLE_EO_CONTROL */ ============================================================ --- sope-appserver/NGXmlRpc/EOSortOrdering+XmlRpcCoding.m 7253a61fcb588cb2f7457396afc359f9a03e2ea1 +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import -#include "common.h" -#include - -@implementation EOSortOrdering(XmlRpcCoding) - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - NSString *k = nil; - SEL sel = NULL; - - k = [_coder decodeStringForKey:@"selector"]; - if (k) sel = NSSelectorFromString(k); - k = [_coder decodeStringForKey:@"key"]; - - return [self initWithKey:k selector:sel]; -} - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self key] forKey:@"key"]; - [_coder encodeString:NSStringFromSelector([self selector]) - forKey:@"selector"]; -} - -@end /* EOSortOrdering(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/GNUmakefile 7f02cc285f0b02fa85e97ecc9b3c5d0b23789c16 +++ /dev/null @@ -1,78 +0,0 @@ -# GNUstep makefile - -include ../../config.make -include $(GNUSTEP_MAKEFILES)/common.make -include ../Version -include ./Version - -ifneq ($(frameworks),yes) -LIBRARY_NAME = libNGXmlRpc -else -FRAMEWORK_NAME = NGXmlRpc -endif - -libNGXmlRpc_PCH_FILE = common.h -libNGXmlRpc_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION) -libNGXmlRpc_INSTALL_DIR=$(SOPE_SYSLIBDIR) -libNGXmlRpc_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION) - -libNGXmlRpc_HEADER_FILES_DIR = . -libNGXmlRpc_HEADER_FILES_INSTALL_DIR = /NGXmlRpc - -libNGXmlRpc_HEADER_FILES = \ - NGAsyncResultProxy.h \ - NGXmlRpc.h \ - NGXmlRpcAction.h \ - NGXmlRpcClient.h \ - NGXmlRpcInvocation.h \ - NGXmlRpcMethodSignature.h \ - NGXmlRpcRequestHandler.h \ - NSObject+Reflection.h \ - WODirectAction+XmlRpc.h \ - WODirectAction+XmlRpcIntrospection.h \ - XmlRpcMethodCall+WO.h \ - XmlRpcMethodResponse+WO.h \ - -libNGXmlRpc_OBJC_FILES = \ - EOFetchSpecification+XmlRpcCoding.m \ - EOKeyGlobalID+XmlRpcCoding.m \ - EONull+XmlRpcCoding.m \ - EOQualifier+XmlRpcCoding.m \ - EOSortOrdering+XmlRpcCoding.m \ - NGAsyncResultProxy.m \ - NGXmlRpcAction.m \ - NGXmlRpcClient.m \ - NGXmlRpcInvocation.m \ - NGXmlRpcMethodSignature.m \ - NGXmlRpcRequestHandler.m \ - NSObject+Reflection.m \ - WODirectAction+XmlRpc.m \ - WODirectAction+XmlRpcIntrospection.m \ - WOMessage+XmlRpcCoding.m \ - WORequest+XmlRpcCoding.m \ - WOResponse+XmlRpcCoding.m \ - XmlRpcMethodCall+WO.m \ - XmlRpcMethodResponse+WO.m \ - NGXmlRpcAction+Registry.m \ - - -# framework support - -NGXmlRpc_PCH_FILE = $(libNGXmlRpc_PCH_FILE) -NGXmlRpc_HEADER_FILES = $(libNGXmlRpc_HEADER_FILES) -NGXmlRpc_OBJC_FILES = $(libNGXmlRpc_OBJC_FILES) - - -# building - --include GNUmakefile.preamble -ifneq ($(FHS_INSTALL_ROOT),) -GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include -endif -ifneq ($(frameworks),yes) -include $(GNUSTEP_MAKEFILES)/library.make -else -include $(GNUSTEP_MAKEFILES)/framework.make -endif -include $(GNUSTEP_MAKEFILES)/tool.make --include GNUmakefile.postamble ============================================================ --- sope-appserver/NGXmlRpc/GNUmakefile.preamble ba431605b9f928b544c31d090bcce1f74232edec +++ /dev/null @@ -1,61 +0,0 @@ -# compilation settings - -SOPE_ROOT=../.. -CORE_ROOT=$(SOPE_ROOT)/sope-core - -ADDITIONAL_CPPFLAGS += -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 -ADDITIONAL_OBJCFLAGS += -Wall -Wno-import -Wno-protocol - -ADDITIONAL_CPPFLAGS += -pipe -Wall -ADDITIONAL_CPPFLAGS += -DCOMPILING_NGOBJWEB=1 - -ADDITIONAL_INCLUDE_DIRS += \ - -I.. -I. -I../.. -I../NGObjWeb/ \ - -I$(CORE_ROOT) \ - -I$(CORE_ROOT)/NGStreams \ - -I$(CORE_ROOT)/NGExtensions \ - -I$(SOPE_ROOT)/sope-xml - - -# dependencies - -libNGXmlRpc_LIBRARIES_DEPEND_UPON += \ - -lNGObjWeb \ - -lNGMime -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC - -NGXmlRpc_LIBRARIES_DEPEND_UPON += \ - -framework NGObjWeb \ - -framework NGMime \ - -framework NGMail \ - -framework NGStreams -framework NGExtensions -framework EOControl \ - -framework XmlRpc -framework DOM -framework SaxObjC - - -# library/framework search pathes - -DEP_DIRS = \ - ../NGObjWeb \ - $(SOPE_ROOT)/sope-mime \ - $(SOPE_ROOT)/sope-mime/NGMail \ - $(SOPE_ROOT)/sope-core/NGStreams \ - $(SOPE_ROOT)/sope-core/NGExtensions \ - $(SOPE_ROOT)/sope-core/EOControl \ - $(SOPE_ROOT)/sope-xml/XmlRpc \ - $(SOPE_ROOT)/sope-xml/DOM \ - $(SOPE_ROOT)/sope-xml/SaxObjC - -ifneq ($(frameworks),yes) -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),\ - -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME)) -else -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) -endif - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64 -else -SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib -endif ============================================================ --- sope-appserver/NGXmlRpc/NGAsyncResultProxy.h 459d4329deae337c37905ef77e4801095d57b396 +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_AsyncResultProxy_H__ -#define __NGXmlRpc_AsyncResultProxy_H__ - -#import - -@class NSException, NSMutableArray, NSString, NSMutableArray; - -@interface NGAsyncResultProxy : NSObject -{ - BOOL isReady; - id result; - id target; - SEL action; - NSString *token; /* response token for NGObjWeb */ - NSMutableArray *keptObjects; /* keep RC for those objects */ -} - -- (BOOL)isReady; -- (id)result; - -- (void)postResult:(id)_result; -- (void)postFaultResult:(NSException *)_result; - -- (void)setTarget:(id)_target; -- (id)target; -- (void)setAction:(SEL)_action; -- (SEL)action; - -- (void)setToken:(NSString *)_token; -- (NSString *)token; - -- (void)becameReady; /* for subclasses to cleanup */ - -- (void)retainObject:(id)_object; -- (void)releaseObject:(id)_object; - -@end - -#endif /* __SkyDaemon_AsyncResultProxy_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGAsyncResultProxy.m a802244e46e5726ad8715313cb65cf1b6f798e3f +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include "common.h" - -@implementation NGAsyncResultProxy - -- (void)dealloc { - [self->token release]; - [self->target release]; - [self->result release]; - [super dealloc]; -} - -/* accessors */ - -- (BOOL)isReady { - return self->isReady; -} -- (id)result { - return self->result; -} - -- (void)setTarget:(id)_target { - ASSIGN(self->target, _target); -} -- (id)target { - return self->target; -} -- (void)setAction:(SEL)_action { - self->action = _action; -} -- (SEL)action { - return self->action; -} - -- (void)setToken:(NSString *)_token { - ASSIGN(self->token, _token); -} -- (NSString *)token { - return self->token; -} - -- (void)becameReady { - AUTORELEASE(self->keptObjects); - self->keptObjects = nil; - - AUTORELEASE(RETAIN(self)); - [self->target performSelector:self->action withObject:self]; -} - -- (void)postResult:(id)_result { - //[self logWithFormat:@"post result: %@", _result]; - self->isReady = YES; - ASSIGN(self->result, _result); - [self becameReady]; -} -- (void)postFaultResult:(NSException *)_result { - //[self logWithFormat:@"post fault result: %@", _result]; - ASSIGN(self->result, _result); - self->isReady = YES; - [self becameReady]; -} - -- (void)retainObject:(id)_object { - if (self->keptObjects == nil) - self->keptObjects = [[NSMutableArray alloc] initWithCapacity:4]; - [self->keptObjects addObject:_object]; -} -- (void)releaseObject:(id)_object { - [[_object retain] autorelease]; - [self->keptObjects removeObjectIdenticalTo:_object]; -} - -/* description */ - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:128]; - - [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; - - if ([self isReady]) - [ms appendFormat:@" ready=%@", self->result]; - else - [ms appendString:@" pending"]; - - [ms appendFormat:@" token=%@", self->token]; - [ms appendFormat:@" target=%@", self->target]; - - if ([self->keptObjects isNotEmpty]) - [ms appendFormat:@" keeping=%@", self->keptObjects]; - - [ms appendString:@">"]; - - return ms; -} - -@end /* NGAsyncResultProxy */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpc-Info.plist f515a0af3b9d2375036f30ed1a1890470a4919f1 +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - NGXmlRpc - CFBundleGetInfoString - - CFBundleIdentifier - org.OpenGroupware.SOPE.appserver.NGXmlRpc - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 4.5 - - ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpc.h 79e6833b4aec557bb6baf2cbeb709de18107c896 +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_H__ -#define __NGXmlRpc_H__ - -#include -#include -#include - -#include -#include -#include - -#endif /* __NGXmlRpc_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcAction+Registry.m 50436f1aaedc1dd9d7d1a2c3b742fdd20debffa9 +++ /dev/null @@ -1,290 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include "common.h" - -@interface NGXmlRpcActionSelMapping : NSObject -{ - NSMutableArray *signatures; - NSMutableArray *selectors; - unsigned count; -} - -- (void)registerSelector:(SEL)_sel forSignature:(NSArray *)_signature; -- (SEL)selectorForSignature:(NSArray *)_signature; -- (NSArray *)signatures; - -@end - -@implementation NGXmlRpcActionSelMapping - -static int logSelMapping = -1; - -- (id)init { - if (logSelMapping == -1) { - logSelMapping = [[NSUserDefaults standardUserDefaults] - boolForKey:@"WOLogXmlRpcSelectorMapping"] - ? 1 : 0; - } - - self->signatures = [[NSMutableArray alloc] initWithCapacity:2]; - self->selectors = [[NSMutableArray alloc] initWithCapacity:2]; - return self; -} -- (void)dealloc { - RELEASE(self->selectors); - RELEASE(self->signatures); - [super dealloc]; -} - -- (void)registerSelector:(SEL)_sel forSignature:(NSArray *)_signature { - [self->signatures addObject:_signature]; - [self->selectors addObject:NSStringFromSelector(_sel)]; - self->count++; -} - -- (BOOL)signature:(NSArray *)_base matches:(NSArray *)_query { - unsigned bc, qc; - - bc = [_base count]; - qc = [_query count]; - if (bc != qc) return NO; - /* should check further */ - return YES; -} -- (SEL)selectorForSignature:(NSArray *)_signature { - unsigned i; - - for (i = 0; i < self->count; i++) { - NSArray *sig; - - sig = [self->signatures objectAtIndex:i]; - if ([self signature:sig matches:_signature]) - return NSSelectorFromString([self->selectors objectAtIndex:i]); - } -#if DEBUG - if (self->count > 0) { - [self debugWithFormat: - @"found no signature matching argcount %i, signatures: %@, got: %@", - ([_signature count] - 1), - self->signatures, _signature]; - } -#endif - return NULL; -} -- (NSArray *)signatures { - return self->signatures; -} - -@end /* NGXmlRpcActionSelMapping */ - -@implementation NGXmlRpcAction(Registry) - -/* class registry */ - -static NSMutableDictionary *uriToClass = nil; -static NSMutableDictionary *classToMethodDict = nil; - -+ (void)registerActionClass:(Class)_class forURI:(NSString *)_uri { - [(id)_class self]; /* ensure initialize */ - if (uriToClass == nil) - uriToClass = [[NSMutableDictionary alloc] initWithCapacity:4]; - [uriToClass setObject:_class forKey:_uri]; - - NSLog(@"%s: mapped uri '%@' to class %@", __PRETTY_FUNCTION__, - _uri, NSStringFromClass(_class)); -} -+ (Class)actionClassForURI:(NSString *)_uri { - return [uriToClass objectForKey:_uri]; -} - -+ (void)registerSelector:(SEL)_selector - forMethodNamed:(NSString *)_method - signature:(id)_signature -{ - NSMutableDictionary *md; - NGXmlRpcActionSelMapping *methodInfo; - - if (![_signature isKindOfClass:[NSArray class]]) - _signature = [[_signature stringValue] componentsSeparatedByString:@","]; - - if (classToMethodDict == nil) - classToMethodDict = [[NSMutableDictionary alloc] initWithCapacity:4]; - - if ((md = [classToMethodDict objectForKey:self]) == nil) { - md = [[NSMutableDictionary alloc] initWithCapacity:16]; - [classToMethodDict setObject:md forKey:self]; - RELEASE(md); - } - - if ((methodInfo = [md objectForKey:_method]) == nil) { - methodInfo = [[NGXmlRpcActionSelMapping alloc] init]; - [md setObject:methodInfo forKey:_method]; - RELEASE(methodInfo); - } - - [methodInfo registerSelector:_selector forSignature:_signature]; - - if (logSelMapping) { - NSLog(@"%@: registered selector %@ for method %@ %@", - NSStringFromClass(self), - NSStringFromSelector(_selector), - _method, - [_signature componentsJoinedByString:@","]); - } -} -+ (SEL)selectorForActionNamed:(NSString *)_name - signature:(NSArray *)_signature -{ - NSMutableDictionary *methodDict; - NGXmlRpcActionSelMapping *methodInfo; - - if ((methodDict = [classToMethodDict objectForKey:self]) == nil) - /* nothing registered */ - return NULL; - - if ((methodInfo = [methodDict objectForKey:_name]) == nil) - /* no action with that name is registered */ - return NULL; - - return [methodInfo selectorForSignature:_signature]; -} - -+ (NSArray *)registeredMethodNames { - NSMutableDictionary *methodDict; - - if ((methodDict = [classToMethodDict objectForKey:self]) == nil) - /* nothing registered */ - return nil; - return [methodDict allKeys]; -} -+ (NSArray *)signaturesForMethodNamed:(NSString *)_name { - NSMutableDictionary *methodDict; - NGXmlRpcActionSelMapping *methodInfo; - - if ((methodDict = [classToMethodDict objectForKey:self]) == nil) - /* nothing registered */ - return NULL; - - if ((methodInfo = [methodDict objectForKey:_name]) == nil) - /* no action with that name is registered */ - return NULL; - - return [methodInfo signatures]; -} - -/* mapping files */ - -+ (BOOL)registerSystemMethods { - if ([self instancesRespondToSelector:@selector(system_listMethodsAction)]) { - [self registerSelector:@selector(system_listMethodsAction) - forMethodNamed:@"system.listMethods" - signature:[NSArray arrayWithObject:@"array"]]; - } - else { - NSLog(@"WARNING(%s): class does not have a listMethods action !", - __PRETTY_FUNCTION__); - } - if ([self instancesRespondToSelector: - @selector(system_methodSignatureAction:)]) { - [self registerSelector:@selector(system_methodSignatureAction:) - forMethodNamed:@"system.methodSignature" - signature:[NSArray arrayWithObjects:@"array", @"string", nil]]; - } - if ([self instancesRespondToSelector: - @selector(system_methodHelpAction:)]) { - [self registerSelector:@selector(system_methodHelpAction:) - forMethodNamed:@"system.methodHelp" - signature:[NSArray arrayWithObjects:@"string", @"string", nil]]; - } - return YES; -} - -+ (BOOL)registerMappingsInFile:(NSString *)_path { - NSString *path; - NSDictionary *cfg; - NSEnumerator *keys; - NSString *methodName; - - if (![_path isAbsolutePath]) { - NSBundle *b; - - b = [NSBundle bundleForClass:self]; - if ((path = [b pathForResource:_path ofType:@"plist"]) == nil) - path = _path; - } - else - path = _path; - - NSLog(@"%s: register mappings in file %@", __PRETTY_FUNCTION__, path); - - if ((cfg = [NSDictionary dictionaryWithContentsOfFile:path]) == nil) { - NSLog(@"%s: could not load file %@", __PRETTY_FUNCTION__, path); - return NO; - } - - if (![self registerSystemMethods]) - return NO; - - keys = [cfg keyEnumerator]; - while ((methodName = [keys nextObject])) { - NSDictionary *mi; - NSEnumerator *sigs; - NSArray *sig; - - if ([methodName hasPrefix:@"__"]) - continue; - - mi = [cfg objectForKey:methodName]; - if (![mi respondsToSelector:@selector(keyEnumerator)]) { - [self logWithFormat:@"entry '%@' in mapping file is no dictionary, skipping: %@", methodName, mi]; - continue; - } - - sigs = [mi keyEnumerator]; - while ((sig = [sigs nextObject])) { - NSString *selName; - SEL sel; - - selName = [mi objectForKey:sig]; - - if ((sel = NSSelectorFromString(selName)) == NULL) { - NSLog(@"%s: did not find selector '%@'", __PRETTY_FUNCTION__, - selName); - continue; - } - - if (![self instancesRespondToSelector:sel]) { - NSLog(@"WARNING(%s): instances of %@ do not respond to selector '%@'", - __PRETTY_FUNCTION__, NSStringFromClass(self), - selName); - } - - [self registerSelector:sel - forMethodNamed:methodName - signature:sig]; - } - } - return YES; -} - -@end /* NGXmlRpcAction(Registry) */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcAction.h b9f37fcd502e6cf2b7c7adcd2403bccdb269c9ae +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_NGXmlRpcAction_H__ -#define __NGXmlRpc_NGXmlRpcAction_H__ - -#import -#import -#include -#include - -@class NSArray, NSString, NSException; -@class XmlRpcMethodCall; -@class NGAsyncResultProxy; -@class WORequest; - -@interface NGXmlRpcAction : NSObject -{ -@protected - WOContext *context; -} - -/* initializer */ - -- (id)initWithContext:(WOContext *)_context; - -/* accessors */ - -- (id)application; -- (WORequest *)request; -- (id)session; -- (id)existingSession; - -/* notifications */ - -- (void)awake; -- (void)sleep; - -/* sandstorm components */ - -- (NSString *)xmlrpcComponentNamespacePrefix; -- (NSString *)xmlrpcComponentName; -- (NSString *)xmlrpcComponentNamespace; - -/* XML-RPC direct action dispatcher ... */ - -- (id)performActionNamed:(NSString *)_name parameters:(NSArray *)_params; -- (id)performMethodCall:(XmlRpcMethodCall *)_call; - -- (id)missingAuthAction; -- (id)accessDeniedAction; - -- (id)actionResponseForResult:(id)resValue; - -/* async operation*/ - -- (WOResponse *)responseForAsyncResult:(NGAsyncResultProxy *)_proxy; - -/* command context */ - -- (BOOL)hasAuthorizationHeader; -- (NSString *)credentials; - -@end - -@interface NGXmlRpcAction(Registry) - -/* class registry */ - -+ (void)registerActionClass:(Class)_class forURI:(NSString *)_uri; -+ (Class)actionClassForURI:(NSString *)_uri; - -/* action registry */ - -+ (BOOL)registerMappingsInFile:(NSString *)_path; - -+ (void)registerSelector:(SEL)_selector - forMethodNamed:(NSString *)_method - signature:(id)_signature; /* either array or CSV */ - -+ (SEL)selectorForActionNamed:(NSString *)_name - signature:(NSArray *)_signature; - -+ (NSArray *)registeredMethodNames; /* can be used for listMethods */ -+ (NSArray *)signaturesForMethodNamed:(NSString *)_method; -+ (NSArray *)registeredMethodNames; - -@end - -@interface WOApplication(XmlRpcActionClass) - -- (Class)defaultActionClassForRequest:(WORequest *)_request; - -@end - -#endif /* __NGXmlRpc_NGXmlRpcAction_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcAction.m 8ebb573c767706eec88c9ae274dbd4a49d396c7f +++ /dev/null @@ -1,499 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" - - -@interface NSException(UserInfoExt) -- (void)setUserInfo:(NSDictionary *)_ui; -@end - -@implementation WOCoreApplication(XmlRpcActionClass) - -- (Class)defaultActionClassForRequest:(WORequest *)_request { - return NSClassFromString(@"DirectAction"); -} - -@end - -@implementation NGXmlRpcAction - -+ (int)version { - return 1; -} - -+ (BOOL)coreOnFault { -#if DEBUG - return [[NSUserDefaults standardUserDefaults] - boolForKey:@"WOCoreOnXmlRpcFault"]; -#else - return NO; -#endif -} - -/* initialization */ - -- (id)initWithContext:(WOContext *)_ctx { - if ((self = [super init])) { - self->context = RETAIN(_ctx); - } - return self; -} -- (id)init { - return [self initWithContext:nil]; -} - -- (void)dealloc { - RELEASE(self->context); - [super dealloc]; -} - -/* sandstorm components */ - -- (NSString *)xmlrpcComponentNamespacePrefix { - NSString *np; - - np = [[NSUserDefaults standardUserDefaults] - stringForKey:@"SxDefaultNamespacePrefix"]; - if ([np isNotEmpty]) - return np; - - [self logWithFormat: - @"WARNING: SxDefaultNamespacePrefix default is not set !"]; - - np = [(NSHost *)[NSHost currentHost] name]; - if ([np isNotEmpty]) { - if (!isdigit([np characterAtIndex:0])) { - NSArray *parts; - - parts = [np componentsSeparatedByString:@"."]; - if (![parts isNotEmpty]) { - } - else if ([parts count] == 1) - return [parts objectAtIndex:0]; - else { - NSEnumerator *e; - BOOL isFirst = YES; - NSString *s; - - e = [parts reverseObjectEnumerator]; - while ((s = [e nextObject])) { - if (isFirst) { - isFirst = NO; - np = s; - } - else { - np = [[np stringByAppendingString:@"."] stringByAppendingString:s]; - } - } - return np; - } - } - } - - return @"com.skyrix"; -} -- (NSString *)xmlrpcComponentName { - NSString *s; - - s = NSStringFromClass([self class]); - if (![s isEqualToString:@"DirectAction"]) - return s; - - return [[NSProcessInfo processInfo] processName]; -} - -- (NSString *)xmlrpcComponentNamespace { - NSString *ns, *n; - - ns = [self xmlrpcComponentNamespacePrefix]; - n = [self xmlrpcComponentName]; - return [[ns stringByAppendingString:@"."] stringByAppendingString:n]; -} - -/* notifications */ - -- (void)awake { -} -- (void)sleep { -} - -- (id)application { - return [WOCoreApplication application]; -} - -- (NSNotificationCenter *)notificationCenter { - return [NSNotificationCenter defaultCenter]; -} - -- (WOContext *)context { - if (self->context == nil) - self->context = RETAIN([[WOApplication application] context]); - return self->context; -} - -- (WORequest *)request { - return [[self context] request]; -} - -- (id)session { - return [[self context] session]; -} - -- (id)existingSession { - WOContext *ctx = [self context]; - - /* check whether the context has a session */ - - return [ctx hasSession] ? [ctx session] : nil; -} - -/* XML-RPC direct action dispatcher ... */ - -- (NSString *)authRealm { - WOApplication *app = [self application]; - return [app name]; -} - -- (id)missingAuthAction { - WOResponse *resp; - NSString *auth; - - auth = [NSString stringWithFormat:@"basic realm=\"%@\"",[self authRealm]]; - - resp = [(WOResponse *)[WOResponse alloc] initWithRequest:[self request]]; - [resp setStatus:401 /* unauthorized */]; - [resp setHeader:auth forKey:@"www-authenticate"]; - // TODO: should embed an XML-RPC fault representing the auth-problem - return [resp autorelease]; -} -- (id)accessDeniedAction { - WOResponse *resp; - NSString *auth; - - auth = [NSString stringWithFormat:@"basic realm=\"%@\"",[self authRealm]]; - - [self logWithFormat:@"access was denied"]; - - resp = [(WOResponse *)[WOResponse alloc] initWithRequest:[self request]]; - [resp setStatus:401 /* unauthorized */]; - [resp setHeader:auth forKey:@"www-authenticate"]; - // TODO: should embed an XML-RPC fault representing the auth-problem - return [resp autorelease]; -} - -- (id)actionResponseForResult:(id)resValue { - if ([resValue isKindOfClass:[NGAsyncResultProxy class]]) { - /* async result ... */ - return [self responseForAsyncResult:resValue]; - } - else if ([resValue conformsToProtocol:@protocol(WOActionResults)]) { - /* a "HTTP" result ... */ - return resValue; - } - else { - /* an XML-RPC result ... */ - XmlRpcMethodResponse *mResponse; - - mResponse = [[[XmlRpcMethodResponse alloc] - initWithResult:resValue] - autorelease]; - return mResponse; - } -} - -- (void)proxyReady:(NGAsyncResultProxy *)_sender { - id ares; - WOResponse *r; - - AUTORELEASE(RETAIN(self)); /* keep me around ;-) */ - - //[self debugWithFormat:@"ready: %@", _sender]; - - [_sender setTarget:nil]; - [_sender setAction:NULL]; - - ares = [self actionResponseForResult:[_sender result]]; - //[self debugWithFormat:@" result: %@", ares]; - - r = [ares generateResponse]; - //[self debugWithFormat:@" response: %@", r]; - - [[self notificationCenter] - postNotificationName:@"WOAsyncResponseReadyNotification" - object:[_sender token] - userInfo:[NSDictionary dictionaryWithObject:r - forKey:@"WOAsyncResponse"]]; -} - -- (WOResponse *)responseForAsyncResult:(NGAsyncResultProxy *)_proxy { - static int cnt = 0; - NSString *token; - WOResponse *r; - NSDictionary *ui; - - //[self debugWithFormat:@"shall create async result for proxy:\n %@", _proxy]; - - token = [NSString stringWithFormat:@"0x%p-%i", _proxy, cnt++]; - //[self debugWithFormat:@"token: %@", token]; - ui = [NSDictionary dictionaryWithObject:token - forKey:@"WOAsyncResponseToken"]; - - r = [WOResponse responseWithRequest:[self request]]; - [r setStatus:20001 /* async response */]; - [r setUserInfo:ui]; - - /* map token to result proxy ... */ - [_proxy setTarget:self]; - [_proxy setAction:@selector(proxyReady:)]; - [_proxy setToken:token]; - - return r; -} - -- (id)faultFromException:(NSException *)_exception - methodCall:(XmlRpcMethodCall *)_call -{ - /* add some more information to generic exceptions ... */ - if (_call) { - NSMutableDictionary *ui; - - ui = [[_exception userInfo] mutableCopy]; - if (ui == nil) ui = [[NSMutableDictionary alloc] init]; - - [ui setObject:[_call methodName] forKey:@"methodName"]; - [ui setObject:[_call parameters] forKey:@"methodParameters"]; - - [_exception setUserInfo:ui]; - RELEASE(ui); - } - - [self logWithFormat:@"%s: turning exception into fault %@\n", - __PRETTY_FUNCTION__, - [_exception description]]; - - if ([[self class] coreOnFault]) - abort(); - - return _exception; -} -- (id)faultFromException:(NSException *)_exception { - return [self faultFromException:_exception methodCall:nil]; -} - -- (NSArray *)signatureForParameters:(NSArray *)_params { - NSMutableArray *ma; - unsigned count, i; - - if ((count = [_params count]) == 0) - return [NSArray arrayWithObject:@"*"]; - - ma = [NSMutableArray arrayWithCapacity:(count + 1)]; - [ma addObject:@"*"]; // return type, unknown from request ... - for (i = 0; i < count; i++) - [ma addObject:[[_params objectAtIndex:i] xmlRpcType]]; - return ma; -} -- (SEL)selectorForXmlRpcAction:(NSString *)_name - parameters:(NSArray *)_params -{ - NSArray *sig = nil; - - if ((sig = [self signatureForParameters:_params]) == nil) - [self logWithFormat:@"found not signature for params ..."]; - - return [[self class] selectorForActionNamed:_name - signature:sig]; -} - -- (NSString *)_methodNameWithoutPrefix:(NSString *)_name { - NSString *n; - int len; - - if ((n = [self xmlrpcComponentNamespacePrefix]) == nil) - return _name; - if ((len = [n length]) == 0) - return _name; - if (![_name hasPrefix:n]) - return _name; - - n = _name; - _name = [_name substringFromIndex:len]; - if ([_name hasPrefix:@"."]) - _name = [_name substringFromIndex:1]; - return _name; -} - -- (id)performActionNamed:(NSString *)_name parameters:(NSArray *)_params { - NSMethodSignature *sign; - NSInvocation *invo; - id result = nil; - SEL sel; - int i, cnt; - NSString *n; - - n = _name; - _name = [self _methodNameWithoutPrefix:_name]; - - /* generate selector */ - if ((sel = [self selectorForXmlRpcAction:_name parameters:_params]) ==NULL) { - /* return a fault .. */ - NSString *r; - NSDictionary *ui; - - [self debugWithFormat:@"found no selector for XML-RPC action %@", _name]; - - ui = nil; - r = [NSString stringWithFormat: - @"found no XML-RPC method named '%@' " - @"(%i parameters, component=%@)", - n, [_params count], [self xmlrpcComponentNamespace]]; - - return [NSException exceptionWithName:@"NoSuchXmlRpcMethod" - reason:r - userInfo:ui]; - } - - sign = [[self class] instanceMethodSignatureForSelector:sel]; - invo = [NSInvocation invocationWithMethodSignature:sign]; - [invo setSelector:sel]; - [invo setTarget:self]; - - /* more arguments may be passed than supported by the method .. */ - cnt = [sign numberOfArguments] - 2; - cnt = (cnt > (int)[_params count]) ? (int)[_params count] : cnt; - for (i = 0; i < cnt; i++) { - id param = [_params objectAtIndex:i]; - /* - TODO: bjoern - is this correct ? shouldnt that break, because the address of - param is always the same (who says, that NSInvocation copies the - values ???) - */ - [invo setArgument:¶m atIndex:(i + 2)]; - } - - /* fill additional selector values with nil ... */ - if (cnt < ((int)[sign numberOfArguments] - 2)) { - static id nilValue = nil; - unsigned int oldCnt = cnt; - - for (i = oldCnt, cnt = ([sign numberOfArguments] - 2); i < cnt; i++) - [invo setArgument:&nilValue atIndex:(i + 2)]; - } - - [invo invoke]; - [invo getReturnValue:&result]; - - return result; -} -- (id)performMethodCall:(XmlRpcMethodCall *)_call { - id resValue; - - NS_DURING { - resValue = [self performActionNamed:[_call methodName] - parameters:[_call parameters]]; - resValue = [resValue retain]; - } - NS_HANDLER { - resValue = [self faultFromException:localException - methodCall:_call]; - if ([[self class] coreOnFault]) - abort(); - resValue = [resValue retain]; - } - NS_ENDHANDLER; - - resValue = [resValue autorelease]; - - if ([[self class] coreOnFault]) { - if ([resValue isKindOfClass:[NSException class]]) { - abort(); - } - } - return [self actionResponseForResult:resValue]; -} - -/* command context */ - -- (BOOL)hasAuthorizationHeader { - WORequest *rq; - NSString *cred; - - if ((rq = [self request]) == nil) - return NO; - - if ((cred = [rq headerForKey:@"authorization"]) == nil) - return NO; - - return YES; -} - -- (NSString *)credentials { - WORequest *rq; - NSString *cred; - NSRange r; - - if ((rq = [self request]) == nil) - return nil; - if ((cred = [rq headerForKey:@"authorization"]) == nil) - return nil; - - r = [cred rangeOfString:@" " options:NSBackwardsSearch]; - if (r.length == 0) { - [self logWithFormat:@"invalid 'authorization' header: '%@'", cred]; - return nil; - } - return [cred substringFromIndex:(r.location + r.length)]; -} - -/* logging */ - -- (NSString *)loggingPrefix { - return [NSString stringWithFormat:@"RPC>%@>", - NSStringFromClass([self class])]; -} - -/* reflection (do not define as a category, as other may do this .. */ - -- (NSArray *)system_listMethodsAction { - NSArray *names; - - names = [[self class] registeredMethodNames]; - names = [names sortedArrayUsingSelector:@selector(compare:)]; - - return names; -} -- (NSArray *)system_methodSignatureAction:(NSString *)_method { - return [[self class] signaturesForMethodNamed:_method]; -} - -@end /* NGXmlRpcAction */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcClient.h 61b10746264f35d542d996778c9c813cc38d0325 +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpcClient_H__ -#define __NGXmlRpcClient_H__ - -#import - -/* - NGXmlRpcClient - - This class is a raw XML-RPC client based on WOHTTPConnection. To see how - it works, take a look at the xmlrpc_call.m tool included in SOPE 4.5. - - XML-RPC over Unix domain sockets. NGXmlRpcClient (will) support XML-RPC over - a Unix domain socket, as used in the ximian_xmlrpclib.py. The transport - protocol used is "$body$\r\n\r\n". - - Usage: - NGXmlRpcClient *server; - - server = - [[NGXmlRpcClient alloc] initWithURL:@"http://betty.userland.com/RPC2"]; - - NSLog(@"result: %@", [server call:@"state.getByNumber", @"42", nil]); -*/ - -@class NSArray, NSString, NSURL, NSDictionary; -@class WOHTTPConnection; - -@interface NGXmlRpcClient : NSObject -{ - /* performing HTTP requests */ - WOHTTPConnection *httpConnection; - NSString *userName; - NSString *password; - NSString *uri; - NSDictionary *additionalHeaders; - - /* performing RAW requests */ - id address; - - /* some transactional state is required for digest authentication */ - id digestInfo; - - // TODO: add timeout parameters -} - -- (id)initWithURL:(id)_url; -- (id)initWithURL:(id)_url login:(NSString *)_login password:(NSString *)_pwd; - -- (id)initWithRawAddress:(id)_address; - -/* accessors */ - -- (void)setUserName:(NSString *)_userName; -- (NSString *)userName; -- (NSString *)login; - -- (void)setPassword:(NSString *)_password; -- (NSString *)password; - -- (void)setUri:(NSString *)_uri; -- (NSString *)uri; - -- (void)setAdditionalHeaders:(NSDictionary *)_headers; -- (NSDictionary *)additionalHeaders; - -/* invoking methods */ - -- (id)invoke:(NSString *)_methodName params:(id)first,...; - -- (id)invokeMethodNamed:(NSString *)_methodName; -- (id)invokeMethodNamed:(NSString *)_methodName withParameter:(id)_param; -- (id)invokeMethodNamed:(NSString *)_methodName parameters:(NSArray *)_params; - -/* - terminate parameter list with nil, eg: - - [rpc call:@"state.getByNumber", @"42", nil]; -*/ -- (id)call:(NSString *)_methodName,...; - -@end - -#endif /* __NGXmlRpcClient_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcClient.m 8160bc4420d72feafc5cf4ca4539de369657701a +++ /dev/null @@ -1,529 +0,0 @@ -/* - Copyright (C) 2000-2007 SKYRIX Software AG - Copyright (C) 2007 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "NGXmlRpcClient.h" -#include "common.h" -#include -#include -#include -#include -#include -#include -#include -#include - -@interface NSString(DigestInfo) -- (NSDictionary *)parseHTTPDigestInfo; -@end - -@implementation NGXmlRpcClient - -+ (int)version { - return 2; -} - -- (Class)connectionClass { - return [WOHTTPConnection class]; -} -- (Class)requestClass { - return [WORequest class]; -} - -- (id)initWithHost:(NSString *)_h uri:(NSString *)_u port:(unsigned int)_port { - if ((self = [super init])) { - self->httpConnection = - [[[self connectionClass] alloc] initWithHost:_h onPort:_port]; - self->uri = [_u copy]; - } - return self; -} - -- (id)initWithHost:(NSString *)_host // e.g. @"inster.in.skyrix.com" - uri:(NSString *)_uri // e.g. @"skyxmlrpc.woa/xmlrpc" - port:(unsigned int)_port // e.g. 20000 - userName:(NSString *)_userName - password:(NSString *)_password -{ - if ((self = [self initWithHost:_host uri:_uri port:_port])) { - self->userName = [_userName copy]; - self->password = [_password copy]; - } - return self; -} -- (id)initWithURL:(id)_url { - NSURL *url; - - url = [_url isKindOfClass:[NSURL class]] - ? _url - : [NSURL URLWithString:[_url stringValue]]; - if (url == nil) { - [self release]; - return nil; - } - - if ((self = [super init])) { - self->httpConnection = - [(WOHTTPConnection *)[[self connectionClass] alloc] initWithURL:url]; - - if ([[url scheme] hasPrefix:@"http"]) - self->uri = [[url path] copy]; - else - /* hack for easier XMLRPC-over-Unix-Domain-sockets */ - self->uri = @"/RPC2"; - self->userName = [[url user] copy]; - self->password = [[url password] copy]; - } - return self; -} -- (id)initWithURL:(id)_url login:(NSString *)_login password:(NSString *)_pwd { - if ((self = [self initWithURL:_url])) { - if (_login) [self setUserName:_login]; - if (_pwd) [self setPassword:_pwd]; - } - return self; -} - -- (id)initWithRawAddress:(id)_address { - if (_address == nil) { - [self release]; - return nil; - } - if ((self = [super init])) { - self->address = [_address retain]; - } - return self; -} - -- (void)dealloc { - [self->additionalHeaders release]; - [self->address release]; - [self->httpConnection release]; - [self->userName release]; - [self->password release]; - [self->uri release]; - [super dealloc]; -} - -/* accessors */ - -- (NSURL *)url { - NSString *p; - NSURL *url; - - // TODO: not final yet ... (hh asks: bjoern, is this used anywhere anyway ?) - p = [[NSString alloc] initWithFormat:@"http://%@:%i%@", - @"localhost", - 80, - self->uri]; - url = [NSURL URLWithString:p]; - [p release]; - return url; -} - -- (void)setUserName:(NSString *)_userName { - ASSIGNCOPY(self->userName, _userName); -} -- (NSString *)userName { - return self->userName; -} -- (NSString *)login { - return self->userName; -} - -- (void)setPassword:(NSString *)_password { - ASSIGNCOPY(self->password, _password); -} -- (NSString *)password { - return self->password; -} - -- (void)setUri:(NSString *)_uri { - ASSIGNCOPY(self->uri, _uri); -} -- (NSString *)uri { - return self->uri; -} - -- (void)setAdditionalHeaders:(NSDictionary *)_headers { - ASSIGNCOPY(self->additionalHeaders, _headers); -} -- (NSDictionary *)additionalHeaders { - return self->additionalHeaders; -} - -/* performing the method */ - -- (id)invokeMethodNamed:(NSString *)_methodName { - return [self invokeMethodNamed:_methodName parameters:nil]; -} - -- (id)invokeMethodNamed:(NSString *)_methodName withParameter:(id)_param { - NSArray *params = nil; - - if (_param) - params = [NSArray arrayWithObject:_param]; - - return [self invokeMethodNamed:_methodName parameters:params]; -} - -- (id)invoke:(NSString *)_methodName params:(id)firstObj,... { - id array, obj, *objects; - va_list list; - unsigned int count; - - va_start(list, firstObj); - for (count = 0, obj = firstObj; obj; obj = va_arg(list,id)) - count++; - va_end(list); - - objects = calloc(count, sizeof(id)); - { - va_start(list, firstObj); - for (count = 0, obj = firstObj; obj; obj = va_arg(list,id)) - objects[count++] = obj; - va_end(list); - - array = [NSArray arrayWithObjects:objects count:count]; - } - free(objects); - - return [self invokeMethodNamed:_methodName parameters:array]; -} - -- (id)call:(NSString *)_methodName,... { - id array, obj, *objects; - va_list list; - unsigned int count; - - va_start(list, _methodName); - for (count = 0, obj = va_arg(list, id); obj; obj = va_arg(list,id)) - count++; - va_end(list); - - objects = calloc(count, sizeof(id)); - { - va_start(list, _methodName); - for (count = 0, obj = va_arg(list, id); obj; obj = va_arg(list,id)) - objects[count++] = obj; - va_end(list); - - array = [NSArray arrayWithObjects:objects count:count]; - } - free(objects); - return [self invokeMethodNamed:_methodName parameters:array]; -} - -- (NSString *)_authorization { - NSString *tmp = nil; - - if (self->userName == nil) - return nil; - - if (self->digestInfo) { - [self logWithFormat:@"need to construct digest authentication using %@", - self->digestInfo]; - return nil; - } - - tmp = @""; - tmp = [tmp stringByAppendingString:self->userName]; - tmp = [tmp stringByAppendingString:@":"]; - - if (self->password) - tmp = [tmp stringByAppendingString:self->password]; - - if (tmp != nil) { - tmp = [tmp stringByEncodingBase64]; - tmp = [@"Basic " stringByAppendingString:tmp]; - } - return tmp; -} - -- (id)sendFailed:(NSException *)e { - if (e) - return e; - else { - return [NSException exceptionWithName:@"XmlRpcSendFailed" - reason: - @"unknown reason, no exception set in " - @"http-connection" - userInfo:nil]; - } -} - -- (id)callFailed:(WOResponse *)_response { - NSException *exc; - NSString *r; - NSDictionary *ui; - int status; - -#if 0 - NSLog(@"%s: XML-RPC response status: %i", __PRETTY_FUNCTION__, - [_response status]); -#endif - - /* construct exception */ - - status = [_response status]; - r = [NSString stringWithFormat:@"call failed with HTTP status code %i", - status]; - if (status == 301 || status == 302) { - NSString *l = [_response headerForKey:@"location"]; - if ([l isNotEmpty]) - r = [NSString stringWithFormat:@"%@ [location=%@]", r, l]; - } - - ui = [NSDictionary dictionaryWithObjectsAndKeys: - self, @"NGXmlRpcClient", - _response, @"WOResponse", - [NSNumber numberWithInt:status], - @"HTTPStatusCode", - nil]; - - exc = [NSException exceptionWithName:@"XmlRpcCallFailed" - reason:r - userInfo:ui]; - return exc; -} -- (id)invalidXmlRpcResponse:(WOResponse *)_response { - return [NSException exceptionWithName:@"XmlRpcCallFailed" - reason:@"got malformed XML-RPC response?!" - userInfo:nil]; -} - -- (id)processHTMLResponse:(WOResponse *)_response { - NSDictionary *ui; - - if (_response == nil) return nil; - [self debugWithFormat:@"Note: got HTML response: %@", _response]; - - ui = [NSDictionary dictionaryWithObjectsAndKeys: - _response, @"response", - nil]; - return [NSException exceptionWithName:@"XmlRpcCallFailed" - reason:@"got HTML response" - userInfo:ui]; -} - -- (id)doCallViaHTTP:(XmlRpcMethodCall *)_call { - XmlRpcMethodResponse *methodResponse; - WOResponse *response; - WORequest *request; - NSString *authorization, *ctype; - - request = [[[self requestClass] alloc] initWithMethod:@"POST" - uri:self->uri - httpVersion:@"HTTP/1.0" - headers:self->additionalHeaders - content:nil - userInfo:nil]; - [request setHeader:@"text/xml" forKey:@"content-type"]; - [request setContentEncoding:NSUTF8StringEncoding]; - [request appendContentString:[_call xmlRpcString]]; - request = [request autorelease]; - - if ((authorization = [self _authorization]) != nil) - [request setHeader:authorization forKey:@"Authorization"]; - - if (![self->httpConnection sendRequest:request]) - return [self sendFailed:[self->httpConnection lastException]]; - - response = [self->httpConnection readResponse]; - - [self->digestInfo release]; self->digestInfo = nil; - - if ([response status] != 200) { - if ([response status] == 401 /* authentication required */) { - /* process info required for digest authentication */ - NSString *wwwauth; - - wwwauth = [response headerForKey:@"www-authenticate"]; - if ([[wwwauth lowercaseString] hasPrefix:@"digest"]) { - self->digestInfo = [[wwwauth parseHTTPDigestInfo] retain]; - //[self debugWithFormat:@"got HTTP digest info: %@", self->digestInfo]; - } - } - - return [self callFailed:response]; - } - - if ((ctype = [response headerForKey:@"content-type"]) == nil) - ctype = @"text/xml"; // TODO, does it make sense? For simplistic servers? - - if ([ctype hasPrefix:@"text/html"]) - return [self processHTMLResponse:response]; - - methodResponse = - [[XmlRpcMethodResponse alloc] initWithXmlRpcString: - [response contentAsString]]; - if (methodResponse == nil) - return [self invalidXmlRpcResponse:response]; - - return [methodResponse autorelease]; -} - -- (id)doRawCall:(XmlRpcMethodCall *)_call { - XmlRpcMethodResponse *methodResponse; - NGActiveSocket *socket; - NGBufferedStream *io; - NSString *s; - NSData *rq; - - /* get body for XML-RPC request */ - - if ((s = [_call xmlRpcString]) == nil) - return nil; - if ((rq = [s dataUsingEncoding:NSUTF8StringEncoding]) == nil) - return nil; - - /* connect */ - - // TODO: add timeout values - socket = [NGActiveSocket socketConnectedToAddress:self->address]; - if (socket == nil) { - [self logWithFormat:@"could not connect %@", self->address]; - return [self sendFailed:nil]; - } - io = [NGBufferedStream filterWithSource:socket bufferSize:4096]; - - /* write body + \r\n\r\n */ - - if (![io writeData:rq]) - return [self sendFailed:[io lastException]]; - if (![io safeWriteBytes:"\r\n\r\n" count:4]) - return [self sendFailed:[io lastException]]; - if (![io flush]) - return [self sendFailed:[io lastException]]; - - /* read response */ - - { - NSMutableData *data; - NSString *s; - - data = [NSMutableData dataWithCapacity:1024]; - do { - unsigned readCount; - unsigned char buf[1024 + 10]; - - readCount = [io readBytes:&buf count:1024]; - if (readCount == NGStreamError) { - NSException *e; - - if ((e = [io lastException]) == nil) - break; - else if ([e isKindOfClass:[NGEndOfStreamException class]]) - break; - else - /* an error */ - return [self sendFailed:e]; - } - buf[readCount] = '\0'; - - [data appendBytes:buf length:readCount]; - } - while (YES); - - s = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - methodResponse = [[XmlRpcMethodResponse alloc] initWithXmlRpcString:s]; - [s release]; - } - - [io close]; - - return [methodResponse autorelease]; -} - -- (id)invokeMethodNamed:(NSString *)_methodName parameters:(NSArray *)_params { - XmlRpcMethodCall *methodCall; - id result; - - methodCall = [[XmlRpcMethodCall alloc] initWithMethodName:_methodName - parameters:_params]; - - if (self->httpConnection) - result = [self doCallViaHTTP:methodCall]; - else - result = [self doRawCall:methodCall]; - - [methodCall release]; methodCall = nil; - - if ([result isKindOfClass:[XmlRpcMethodResponse class]]) - result = [result result]; - - if (result == nil) - [self logWithFormat:@"got nil value from XML-RPC ..."]; - return result; -} - -@end /* NGXmlRpcClient */ - -@implementation NSString(DigestInfo) - -- (NSDictionary *)parseHTTPDigestInfo { - /* - eg: - www-authenticate: Digest realm="RCD", \ - nonce="1572920321042107679", \ - qop="auth,auth-int", \ - algorithm="MD5,MD5-sess" - */ - NSMutableDictionary *md; - NSEnumerator *parts; - NSString *part; - - md = [NSMutableDictionary dictionaryWithCapacity:8]; - - /* - TODO: fix this parser, it only works if the components of the header - value are separated using ", " and the component *values* are separated - by a "," (not followed by a space). - Works with rcd, probably with nothing else ... - */ - parts = [[self componentsSeparatedByString:@", "] objectEnumerator]; - - while ((part = [parts nextObject])) { - NSRange r; - NSString *key, *value; - - r = [part rangeOfString:@"="]; - if (r.length == 0) continue; - - key = [[part substringToIndex:r.location] stringByTrimmingSpaces]; - value = [[part substringFromIndex:(r.location + r.length)] - stringByTrimmingSpaces]; - - //[self logWithFormat:@"key '%@' value '%@'", key, value]; - - if ([value hasPrefix:@"\""] && [value hasSuffix:@"\""]) { - r.location = 1; - r.length = [value length] - 2; - value = [value substringWithRange:r]; - } - //[self logWithFormat:@"key '%@' value '%@'", key, value]; - - [md setObject:value forKey:[key lowercaseString]]; - } - return md; -} - -@end /* NSString(DigestInfo) */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcInvocation.h 592958606791ebb1f48f7c47fafa201a66e18125 +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpcInvocation_H__ -#define __NGXmlRpcInvocation_H__ - -#import - -@class NSString, NSMutableArray; -@class NGXmlRpcClient; -@class NGXmlRpcMethodSignature; - -@interface NGXmlRpcInvocation : NSObject < NSCoding > -{ - NGXmlRpcClient *target; - NSString *methodName; - NGXmlRpcMethodSignature *signature; - - NSMutableArray *arguments; - id result; -} - -- (id)initWithMethodSignature:(NGXmlRpcMethodSignature *)_sig; - -/* arguments */ - -- (NGXmlRpcMethodSignature *)methodSignature; - -- (void)setArgument:(id)_argument atIndex:(int)index; -- (id)argumentAtIndex:(int)index; - -- (void)setReturnValue:(id)_result; -- (id)returnValue; - -- (void)setMethodName:(NSString *)_mname; -- (NSString *)methodName; - -- (void)setTarget:(NGXmlRpcClient *)_target; -- (NGXmlRpcClient *)target; - -/* Dispatching an Invocation */ - -- (void)invoke; -- (void)invokeWithTarget:(NGXmlRpcClient *)_target; - -@end - -@interface NSObject(XmlRpcValue) - -- (id)asXmlRpcValueOfType:(NSString *)_xmlRpcValueType; - -@end - -#endif /* __NGXmlRpcInvocation_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcInvocation.m 81c42bcd131939e4a085ead8e6ee044ae9cb36d8 +++ /dev/null @@ -1,291 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "NGXmlRpcInvocation.h" -#include "NGXmlRpcMethodSignature.h" -#include "NGXmlRpcClient.h" -#include "common.h" - -@implementation NGXmlRpcInvocation - -static NSNull *null = nil; - -- (void)_ensureArgs { - unsigned i, count; - - if (self->arguments) return; - if (self->signature == nil) return; - if (null == nil) null = [[NSNull null] retain]; - - count = [self->signature numberOfArguments]; - - self->arguments = [[NSMutableArray alloc] initWithCapacity:count]; - for (i = 0; i < count; i++) - [self->arguments addObject:null]; -} - -- (id)initWithMethodSignature:(NGXmlRpcMethodSignature *)_sig { - if (_sig == nil) { - RELEASE(self); - return nil; - } - - self->signature = RETAIN(_sig); - [self _ensureArgs]; - - return self; -} -- (id)init { - return [self initWithMethodSignature:nil]; -} - -- (void)dealloc { - RELEASE(self->arguments); - RELEASE(self->result); - RELEASE(self->target); - RELEASE(self->methodName); - RELEASE(self->signature); - [super dealloc]; -} - -/* arguments */ - -- (NGXmlRpcMethodSignature *)methodSignature { - return self->signature; -} - -- (void)setArgument:(id)_argument atIndex:(int)_idx { - if (_argument == nil) _argument = null; - [self->arguments replaceObjectAtIndex:_idx withObject:_argument]; -} -- (id)argumentAtIndex:(int)_idx { - id res; - - res = [self->arguments objectAtIndex:_idx]; - if (res == null) res = nil; - return res; -} - -- (void)setTarget:(NGXmlRpcClient *)_target { - ASSIGN(self->target, _target); -} -- (NGXmlRpcClient *)target { - return self->target; -} - -- (void)setMethodName:(NSString *)_name { - ASSIGNCOPY(self->methodName, _name); -} -- (NSString *)methodName { - return self->methodName; -} - -- (void)setReturnValue:(id)_result { - ASSIGN(self->result, _result); -} -- (id)returnValue { - return self->result; -} - -/* Dispatching an Invocation */ - -- (void)invoke { - [self invokeWithTarget:[self target]]; -} - -- (void)invokeWithTarget:(NGXmlRpcClient *)_target { - NSAutoreleasePool *pool; - - pool = [[NSAutoreleasePool alloc] init]; - { - NSArray *args; - id res; - unsigned count; - NGXmlRpcMethodSignature *sig; - - sig = [self methodSignature]; - - /* collect arguments, coerce types ... */ - if ((count = [self->arguments count]) == 0) - args = self->arguments; - else if (sig) { - unsigned i; - id *aa; - - aa = calloc(count + 2 /* be defensive, yeah! */, sizeof(id)); - for (i = 0; i < count; i++) { - NSString *xrtype; - id value; - - xrtype = [sig argumentTypeAtIndex:i]; - - value = [self->arguments objectAtIndex:i]; - value = [value asXmlRpcValueOfType:xrtype]; - aa[i] = value != nil ? value : (id)null; - } - args = [NSArray arrayWithObjects:aa count:count]; - if (aa != NULL) free(aa); - } - else - args = self->arguments; - - /* invoke remote method */ - res = [_target invokeMethodNamed:[self methodName] parameters:args]; - - /* store return value */ - [self setReturnValue:res]; - } - RELEASE(pool); -} - -/* NSCoding */ - -- (void)encodeWithCoder:(NSCoder *)_coder { - [_coder encodeObject:self->target]; - [_coder encodeObject:self->methodName]; - [_coder encodeObject:self->signature]; - [_coder encodeObject:self->arguments]; - [_coder encodeObject:self->result]; -} -- (id)initWithCoder:(NSCoder *)_coder { - if (null == nil) null = [[NSNull null] retain]; - - self->target = [[_coder decodeObject] retain]; - self->methodName = [[_coder decodeObject] copy]; - self->signature = [[_coder decodeObject] retain]; - self->arguments = [[_coder decodeObject] retain]; - self->result = [[_coder decodeObject] retain]; - - if (self->signature == nil) { - NSLog(@"%s: missing signature (required during decoding)", - __PRETTY_FUNCTION__); - RELEASE(self); - return nil; - } - [self _ensureArgs]; - - return self; -} - -@end /* NGXmlRpcInvocation */ - -@implementation NSObject(XmlRpcValue) - -- (NSArray *)asXmlRpcArray { - if ([self respondsToSelector:@selector(objectEnumerator)]) { - return [[[NSArray alloc] - initWithObjectsFromEnumerator: - [(id)self objectEnumerator]] - autorelease]; - } - return nil; -} - -- (NSDictionary *)asXmlRpcStruct { - return [self valuesForKeys:[[self classDescription] attributeKeys]]; -} - -- (NSString *)asXmlRpcString { - return [self stringValue]; -} -- (int)asXmlRpcInt { - return [self intValue]; -} -- (int)asXmlRpcDouble { - return [self doubleValue]; -} - -- (NSData *)asXmlRpcBase64 { - return [[self stringValue] dataUsingEncoding:NSUTF8StringEncoding]; -} -- (NSDate *)asXmlRpcDateTime { - return [[[NSDate alloc] initWithString:[self stringValue]] autorelease]; -} - -- (id)asXmlRpcValueOfType:(NSString *)_xmlRpcValueType { - unsigned len; - - if ((len = [_xmlRpcValueType length]) == 0) - return self; - - if ([_xmlRpcValueType isEqualToString:@"string"]) - return [self asXmlRpcString]; - if ([_xmlRpcValueType isEqualToString:@"int"]) - return [NSNumber numberWithInt:[self asXmlRpcInt]]; - if ([_xmlRpcValueType isEqualToString:@"i4"]) - return [NSNumber numberWithInt:[self asXmlRpcInt]]; - if ([_xmlRpcValueType isEqualToString:@"double"]) - return [NSNumber numberWithDouble:[self asXmlRpcDouble]]; - if ([_xmlRpcValueType isEqualToString:@"float"]) - return [NSNumber numberWithDouble:[self asXmlRpcDouble]]; - if ([_xmlRpcValueType isEqualToString:@"array"]) - return [self asXmlRpcArray]; - if ([_xmlRpcValueType isEqualToString:@"struct"]) - return [self asXmlRpcStruct]; - if ([_xmlRpcValueType isEqualToString:@"datetime"]) - return [self asXmlRpcDateTime]; - if ([_xmlRpcValueType isEqualToString:@"base64"]) - return [self asXmlRpcBase64]; - - return self; -} - -@end /* NSObject(XmlRpcValue) */ - -@implementation NSArray(XmlRpcValue) - -- (NSArray *)asXmlRpcArray { - return self; -} - -- (id)asXmlRpcValueOfType:(NSString *)_xmlRpcValueType { - return self; -} - -@end /* NSArray(XmlRpcValue) */ - -@implementation NSDictionary(XmlRpcValue) - -- (NSArray *)asXmlRpcArray { - return [self allValues]; -} - -- (NSDictionary *)asXmlRpcStruct { - return self; -} - -@end /* NSDictionary(XmlRpcValue) */ - -@implementation NSDate(XmlRpcValue) - -- (NSDate *)asXmlRpcDateTime { - return self; -} - -@end /* NSDate(XmlRpcValue) */ - -@implementation NSData(XmlRpcValue) - -- (NSData *)asXmlRpcBase64 { - return self; -} - -@end /* NSCalendarDate(XmlRpcValue) */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcMethodSignature.h 432b988e1e8cb5453b88c148289666b12e792bf3 +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpcMethodSignature_H__ -#define __NGXmlRpcMethodSignature_H__ - -#import - -/* - XML-RPC types: - string - i4 - base64 - datetime -*/ - -@class NSArray; - -@interface NGXmlRpcMethodSignature : NSObject -{ - NSArray *signature; -} - -+ (id)signatureWithXmlRpcTypes:(NSArray *)_args; -- (id)initWithXmlRpcTypes:(NSArray *)_arg; - -- (unsigned)numberOfArguments; -- (NSString *)argumentTypeAtIndex:(unsigned int)_idx; -- (NSString *)methodReturnType; -- (BOOL)isOneway; - -- (NSArray *)xmlRpcTypes; - -@end - -#endif /* __NGXmlRpcMethodSignature_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcMethodSignature.m 629b39286340385b4ac6bf438b569331204b77b7 +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "NGXmlRpcMethodSignature.h" -#include "common.h" - -@implementation NGXmlRpcMethodSignature - -+ (id)signatureWithXmlRpcTypes:(NSArray *)_args { - return [[[self alloc] initWithXmlRpcTypes:_args] autorelease]; -} -- (id)initWithXmlRpcTypes:(NSArray *)_arg { - if (![_arg isNotEmpty]) { - RELEASE(self); - return nil; - } - self->signature = [_arg copy]; - return self; -} -- (id)init { - return [self initWithXmlRpcTypes:nil]; -} - -- (unsigned)numberOfArguments { - return ([self->signature count] - 1); -} - -- (NSString *)argumentTypeAtIndex:(unsigned int)_idx { - return [self->signature objectAtIndex:(_idx + 1)]; -} - -- (NSString *)methodReturnType { - return [self->signature objectAtIndex:0]; -} - -- (BOOL)isOneway { - return NO; -} - -- (NSArray *)xmlRpcTypes { - return self->signature; -} - -@end /* NGXmlRpcMethodSignature */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcRequestHandler.h c844bc41ec76fef968415c34aaf921687b9021d9 +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_XmlRpcRequestHandler_H__ -#define __NGXmlRpc_XmlRpcRequestHandler_H__ - -#include - -@interface NGXmlRpcRequestHandler : WORequestHandler -@end - -#endif /* __NGXmlRpc_WORequestHandler_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NGXmlRpcRequestHandler.m e6feeaf220543c691efa379c5458d8108de10792 +++ /dev/null @@ -1,251 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" - -static BOOL perflog = NO; -static Class NSDateClass = Nil; - -//#define USE_POOLS 1 - -@interface NSObject(RPC2) -- (id)RPC2Action; -@end - -@implementation NGXmlRpcRequestHandler - -+ (int)version { - return [super version] + 0 /* 2 */; -} -+ (void)initialize { - NSAssert2([super version] == 2, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - - NSDateClass = [NSDate class]; - perflog = [[NSUserDefaults standardUserDefaults] - boolForKey: - @"WOProfileXmlRpcActionRequestHandler"]; -} - -/* - The request handler part of a direct action URI looks like this: - - [actionClass/]actionName[?key=value&key=value&...] -*/ - -- (WOResponse *)_runObject:(NGXmlRpcAction *)_object - request:(WORequest *)_req -{ - WOResponse *result; - XmlRpcMethodCall *call; - - if (_object == nil) return nil; - - if (![[_req method] isEqualToString:@"POST"]) { - /* only POST is allowed ! */ - return nil; - } - - call = [(XmlRpcMethodCall *)[XmlRpcMethodCall alloc] initWithRequest:_req]; - call = [call autorelease]; - - if (call == nil) { - NSData *content; - - content = [_req content]; - - [self logWithFormat:@"couldn't decode XMLRPC content:\n"]; - [self logWithFormat:@" content-len: %d", [content length]]; - [self logWithFormat:@" encoding: %d", [_req contentEncoding]]; - result = nil; - } - else { - [_object awake]; - result = [[_object performMethodCall:call] generateResponse]; - [_object sleep]; - } - - if (result == nil) - return nil; - - if (![result isKindOfClass:[WOResponse class]]) { - /* morph an object result into a XML-RPC response .. */ - XmlRpcMethodResponse *r; - - r = [[XmlRpcMethodResponse alloc] initWithResult:result]; - result = [[[r generateResponse] retain] autorelease]; - [r release]; - } - - return result; -} - -- (WOResponse *)handleRequest:(WORequest *)_request { - NSTimeInterval startHandling = 0.0; -#if USE_POOLS - NSAutoreleasePool *pool = nil; -#endif - WOApplication *app; - NSString *handlerPath = nil; - NSString *actionClassName; - WOResponse *response = nil; - WOContext *context = nil; - NSThread *thread; - NSMutableDictionary *threadDict; - Class actionClass = Nil; - - if (![[_request method] isEqualToString:@"POST"]) { - [self logWithFormat:@"only POST requests are valid XML-RPC requests ..."]; - return nil; - } - - if (perflog) - startHandling = [[NSDateClass date] timeIntervalSince1970]; - - thread = [NSThread currentThread]; - NSAssert(thread, @"missing current thread ..."); - threadDict = [thread threadDictionary]; - NSAssert(threadDict, @"missing current thread's dictionary ..."); - - if (_request == nil) return nil; - - *(&app) = nil; - *(&actionClassName) = nil; - - app = [WOApplication application]; - - handlerPath = [_request uri]; - actionClass = [NGXmlRpcAction actionClassForURI:handlerPath]; - - if (actionClass == Nil) { - [self logWithFormat:@"found no action class for URI: %@", handlerPath]; - actionClass = [app defaultActionClassForRequest:_request]; - } - -#if DEBUG_XMLRPC_ACTION - NSLog(@"[XML-RPC request handler] class=%@ ..", - actionClassName); -#endif - -#if USE_POOLS - *(&pool) = [[NSAutoreleasePool alloc] init]; -#endif - { - /* setup context */ - context = [WOContext contextWithRequest:_request]; - NSAssert(context, @"no context assigned .."); - NSAssert(threadDict, @"missing current thread's dictionary ..."); - [threadDict setObject:context forKey:@"WOContext"]; - - NS_DURING { - [app awake]; - { - NGXmlRpcAction *actionObject = nil; - id result = nil; - - *(&result) = nil; - - NS_DURING { -#if USE_POOLS - NSAutoreleasePool *pool2 = [NSAutoreleasePool new]; -#endif - - { - /* create direct action object */ - actionObject = [actionClass alloc]; - actionObject = [actionObject initWithContext:context]; - actionObject = [actionObject autorelease]; - - if (actionObject == nil) { - [app logWithFormat: - @"ERROR: could not create direct action object of class %@", - actionClassName]; - actionObject = nil; - } - else { - result = [self _runObject:actionObject request:_request]; - result = [(id)result retain]; - - if (result == nil) { - [self logWithFormat: - @"WARNING: got empty result from action .."]; - response = [WOResponse alloc]; - response = [response initWithRequest:_request]; - [response setStatus:500]; - } - else { - /* generate response */ - response = [[result generateResponse] retain]; - } - - [(id)result release]; result = nil; - } - } - -#if USE_POOLS - RELEASE(pool2); pool2 = nil; -#endif - response = [response autorelease]; - } - NS_HANDLER { - response = [app handleException:localException inContext:context]; - } - NS_ENDHANDLER; - - response = [response retain]; - } - [app sleep]; - } - NS_HANDLER { - response = [app handleException:localException inContext:context]; - response = [response retain]; - } - NS_ENDHANDLER; - - NSAssert(threadDict, @"missing current thread's dictionary ..."); - [threadDict removeObjectForKey:@"WOContext"]; - } -#if USE_POOLS - [pool release]; pool = nil; -#endif - - if (perflog) { - NSTimeInterval rt; - rt = [[NSDateClass date] timeIntervalSince1970] - startHandling; - NSLog(@"[da-handler]: handleRequest took %4.3fs.", - rt < 0.0 ? -1.0 : rt); - } - - return AUTORELEASE(response); -} - -@end /* NGXmlRpcRequestHandler */ ============================================================ --- sope-appserver/NGXmlRpc/NSObject+Reflection.h 8edfbe240ec1863fdbdf71afd5d5acc818e0265d +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NSObject_Reflection_H__ -#define __NSObject_Reflection_H__ - -@interface NSObject(Reflection) - -/* this method returns the selectors defined by the exact class only */ -+ (NSArray *)classImplementsSelectors; - -/* those two methods return the selectors defined by the whole class hierachy*/ -+ (NSArray *)instancesRespondToSelectors; -- (NSArray *)respondsToSelectors; - -@end /* NSObject(Reflection) */ - -#endif /* __NSObject_Reflection_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/NSObject+Reflection.m 39d3f801679d07708d04a1e20adece06bc09b8b0 +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "common.h" -#import -#import -#import - -#if NeXT_RUNTIME || APPLE_RUNTIME -# import -# import -#else -# import -#endif - -@implementation NSObject(Reflection) - -+ (void)_addSelectorsOfClassToArray:(NSMutableSet *)_sels { -#if GNU_RUNTIME - MethodList_t methods; - - for (methods = ((Class)self)->methods; methods; - methods = methods->method_next) { - int i; - - for (i = 0; i < methods->method_count; i++) { - Method_t internalMethod; - SEL sel; - NSString *selName; - - internalMethod = &(methods->method_list[i]); - sel = internalMethod->method_name; - selName = NSStringFromSelector(sel); - - if (![selName isNotEmpty]) { - NSLog(@"WARNING(%s): did not get selector for method 0x%p", - __PRETTY_FUNCTION__, internalMethod); - continue; - } - - [_sels addObject:selName]; - } - } -#else - struct objc_method_list *mlist; - void *iterator = NULL; - - //NSLog(@"adding selectors of class: %@", NSStringFromClass(self)); - - while ((mlist = class_nextMethodList(self, &iterator)) != NULL) { - int mcount; - - //NSLog(@" processing %i selectors ...", mlist->method_count); - - for (mcount = mlist->method_count; mcount > 0; mcount--) { - NSString *selName; - SEL sel; - - if ((sel = mlist->method_list[mcount - 1].method_name) == NULL) - continue; - - selName = NSStringFromSelector(sel); - if (![selName isNotEmpty]) { - NSLog(@"WARNING(%s): did not get selector for method 0x%p", - __PRETTY_FUNCTION__, mlist->method_list[mcount - 1]); - continue; - } - [_sels addObject:selName]; - } - } -#endif -} - -+ (NSArray *)classImplementsSelectors { - NSMutableSet *a; - - a = [[[NSMutableSet alloc] initWithCapacity:32] autorelease]; - [self _addSelectorsOfClassToArray:a]; - return [a allObjects]; -} - -+ (NSArray *)instancesRespondToSelectors { - NSMutableSet *a; - Class clazz; - - a = [NSMutableSet setWithCapacity:128]; - for (clazz = self; clazz; clazz = [clazz superclass]) - [clazz _addSelectorsOfClassToArray:a]; - return [a allObjects]; -} - -- (NSArray *)respondsToSelectors { - return [[self class] instancesRespondToSelectors]; -} - -@end /* NSObject(Reflection) */ ============================================================ --- sope-appserver/NGXmlRpc/Version aaeba5de713bab40893db8de399daa29ceca8955 +++ /dev/null @@ -1,3 +0,0 @@ -# version file - -SUBMINOR_VERSION:=17 ============================================================ --- sope-appserver/NGXmlRpc/WODirectAction+XmlRpc.h fa93e043c9f4046b316188f4f69a8a5fce1bbcae +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WODirectAction_XMLRPC_H__ -#define __WODirectAction_XMLRPC_H__ - -#import -@class NSString, NSArray; - -@interface WODirectAction(XmlRpc) -- (NSString *)xmlrpcComponentNamespacePrefix; -- (NSString *)xmlrpcComponentName; -- (NSString *)xmlrpcComponentNamespace; -@end /* WODirectAction(XmlRpc) */ - -@interface WODirectAction(XmlRpcValues) - -/* mapping XML-RPC actions to selectors */ - -- (NSString *)selectorForXmlRpcAction:(NSString *)_name; -- (NSString *)selectorForXmlRpcAction:(NSString *)_name - parameters:(NSArray *)_params; - -/* dispatcher */ - -- (id)performActionNamed:(NSString *)_actionName parameters:(NSArray *)_params; - -/* direct action */ - -- (id)RPC2Action; - -@end - -@interface WODirectAction(XmlRpcInfo) - -/* - use reflection to show an "WebService" info page ... -*/ -- (id)RPC2InfoPageAction; - -@end - -#endif /* __WODirectAction_XMLRPC_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/WODirectAction+XmlRpc.m 42c8ae09be49db8b069a2ade550846f18fd6ffec +++ /dev/null @@ -1,351 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WODirectAction+XmlRpc.h" -#include -#include -#include -#include -#include -#include "common.h" - -@implementation WODirectAction(XmlRpc) - -static int CoreOnException = -1; - -- (NSString *)xmlrpcComponentNamespacePrefix { - // TODO: should be deprecated - NSUserDefaults *ud; - NSString *np; - - ud = [NSUserDefaults standardUserDefaults]; - np = [ud stringForKey:@"SxDefaultNamespacePrefix"]; - if ([np isNotEmpty]) - return np; - - [self logWithFormat: - @"WARNING: SxDefaultNamespacePrefix default is not set !"]; - - np = [(NSHost *)[NSHost currentHost] name]; - if ([np isNotEmpty]) { - if (!isdigit([np characterAtIndex:0])) { - NSArray *parts; - - parts = [np componentsSeparatedByString:@"."]; - if (![parts isNotEmpty]) { - } - else if ([parts count] == 1) - return [parts objectAtIndex:0]; - else { - NSEnumerator *e; - BOOL isFirst = YES; - NSString *s; - - e = [parts reverseObjectEnumerator]; - while ((s = [e nextObject])) { - if (isFirst) { - isFirst = NO; - np = s; - } - else { - np = [[np stringByAppendingString:@"."] stringByAppendingString:s]; - } - } - return np; - } - } - } - - return @"com.skyrix"; -} -- (NSString *)xmlrpcComponentName { - // TODO: should be deprecated - NSString *s; - - s = NSStringFromClass([self class]); - if (![s isEqualToString:@"DirectAction"]) - return s; - - return [[NSProcessInfo processInfo] processName]; -} - -- (NSString *)xmlrpcComponentNamespace { - // TODO: should be deprecated - NSString *ns, *n; - - ns = [self xmlrpcComponentNamespacePrefix]; - n = [self xmlrpcComponentName]; - return [[ns stringByAppendingString:@"."] stringByAppendingString:n]; -} - -- (NSArray *)_methodActionNames { - NSMutableArray *ma; - NSEnumerator *sels; - NSString *sel; - - sels = [[self respondsToSelectors] objectEnumerator]; - - ma = [NSMutableArray arrayWithCapacity:16]; - while ((sel = [sels nextObject])) { - unsigned idx, len; - NSString *actionName; - NSRange rng; - - rng = [sel rangeOfString:@"Action"]; - if (rng.length <= 0) continue; - - actionName = sel; - - /* ensure that only dots are following the 'Action' */ - for (idx = (rng.location + rng.length), len = [sel length]; - idx < len; idx++) { - unichar c = [sel characterAtIndex:idx]; - if (c != ':') { - actionName = nil; - break; - } - } - - /* go to next selector if ... */ - if (![actionName isNotEmpty]) continue; - - /* add to reflection set */ - [ma addObject:actionName]; - } - return [[ma copy] autorelease]; -} - -- (NSString *)selectorForXmlRpcAction:(NSString *)_name { - NSString *actionName; - NSString *p; - - actionName = @"Action"; - - /* check component namespace and strip it ;-) */ - - p = [self xmlrpcComponentNamespace]; - - if ([p isNotEmpty]) { - if ([_name hasPrefix:@"system."]) - ; - else if ([_name hasPrefix:p]) { - _name = [_name substringFromIndex:[p length]]; - if ([_name isNotEmpty]) { - if ([_name characterAtIndex:0] == '.') - _name = [_name substringFromIndex:1]; - } - } - else { - [self logWithFormat: - @"WARNING: tried to invoke XML-RPC method from " - @"different component (namespace=%@): %@", - p, _name]; - } - } - - /* replace namespace points by '_' */ - - _name = [_name stringByReplacingString:@"." withString:@"_"]; - actionName = [_name stringByAppendingString:actionName]; - - /* finished */ - return actionName; -} - -- (NSString *)selectorForXmlRpcAction:(NSString *)_name - parameters:(NSArray *)_params -{ - NSString *actionName; - int i, cnt; - - actionName = [self selectorForXmlRpcAction:_name]; - - /* append ':' for each parameter */ - - switch ((cnt = [_params count])) { - case 0: - break; - case 1: - actionName = [actionName stringByAppendingString:@":"]; - break; - case 2: - actionName = [actionName stringByAppendingString:@"::"]; - break; - case 3: - actionName = [actionName stringByAppendingString:@":::"]; - break; - case 4: - actionName = [actionName stringByAppendingString:@"::::"]; - break; - - default: - for (i = 0, cnt = [_params count]; i < cnt; i++) - actionName = [actionName stringByAppendingString:@":"]; - break; - } - - /* finished */ - return actionName; -} - -- (id)performActionNamed:(NSString *)_name parameters:(NSArray *)_params { - NSMethodSignature *sign; - NSInvocation *invo; - NSString *actionName; - id result = nil; - SEL sel; - int i, cnt = 0; - - /* generate selector */ - actionName = [self selectorForXmlRpcAction:_name parameters:_params]; - sel = NSSelectorFromString(actionName); - - if (![self respondsToSelector:sel]) { - NSEnumerator *actEnum; - NSString *name = nil; - NSString *act = nil; - - actEnum = [[self _methodActionNames] objectEnumerator]; - name = [actionName stringByReplacingString:@":" withString:@""]; - actionName = nil; - while ((act = [actEnum nextObject])) { - NSString *tmp = [act stringByReplacingString:@":" withString:@""]; - - if ([tmp isEqualToString:name]) actionName = act; - } - sel = NSSelectorFromString(actionName); - - if (sel == NULL) { - /* Note: NULL selectors are not caught by MacOSX -respondsToSel: ! */ - [self logWithFormat:@"no such XMLRPC action: '%@'", _name]; - return [NSException exceptionWithName:@"NoSuchAction" - reason:@"action not implemented" - userInfo:nil]; - } - else if (![self respondsToSelector:sel]) { - [self logWithFormat:@"no such XMLRPC action: '%@' (selector=%@)", - _name, NSStringFromSelector(sel)]; - - return [NSException exceptionWithName:@"NoSuchAction" - reason:@"action not implemented" - userInfo:nil]; - } - else { - // count the ':' - cnt = [[actionName componentsSeparatedByString:@":"] count] - 1; - } - } - sign = [[self class] instanceMethodSignatureForSelector:sel]; - invo = [NSInvocation invocationWithMethodSignature:sign]; - [invo setSelector:sel]; - if (cnt == 0) cnt = ([sign numberOfArguments] - 2); - - [invo setTarget:self]; - - cnt = (cnt > (int)[_params count]) ? (int)[_params count] : cnt; - - for (i = 0; i < cnt; i++) { - id param; - - param = [_params objectAtIndex:i]; - [invo setArgument:¶m atIndex:(i + 2)]; - } - // TODO(hh): should fill the remaining args when less params available ? - - [invo invoke]; - [invo getReturnValue:&result]; - - return result; -} - -- (id)_faultForException:(NSException *)_exception { - if (CoreOnException == -1) { - // TODO: add default - CoreOnException = - [[NSUserDefaults standardUserDefaults] - boolForKey:@"WOCoreOnXmlRpcFault"] ? 1 : 0; - } - - if (CoreOnException) { - [self logWithFormat:@"core on exception: %@", _exception]; - abort(); - return nil; - } - else { - [self logWithFormat:@"turn exception into fault: %@", _exception]; - return _exception; - } -} - -- (id)RPC2Action { - XmlRpcMethodCall *call; - XmlRpcMethodResponse *mResponse; - id result; - - if (![[[self request] method] isEqualToString:@"POST"]) { - /* only POST is allowed for direct XML-RPC requests ! */ - - if ([[[self request] method] isEqualToString:@"GET"]) - return [self RPC2InfoPageAction]; - - return nil; - } - - call = [XmlRpcMethodCall alloc]; - call = [[call initWithRequest:[self request]] autorelease]; - - if (call == nil) { - WORequest *rq; - NSData *content; - - rq = [self request]; - content = [rq content]; - - [self logWithFormat:@"couldn't decode XMLRPC content:\n"]; - [self logWithFormat:@" content-len: %d", [content length]]; - [self logWithFormat:@" encoding: %d", [rq contentEncoding]]; - return nil; - } - - [self debugWithFormat:@"decoded XMLRPC call: %@", call]; - - NS_DURING { - result = [[self performActionNamed:[call methodName] - parameters:[call parameters]] - retain]; - } - NS_HANDLER - result = [[self _faultForException:localException] retain]; - NS_ENDHANDLER; - - mResponse = - [[[XmlRpcMethodResponse alloc] initWithResult:result] autorelease]; - - [result release]; result = nil; - - return [mResponse generateResponse]; -} -- (id)xmlrpcAction { - [self debugWithFormat:@"deprecated, please use /RPC2 as direct action !"]; - return [self RPC2Action]; -} - -@end /* WODirectAction(XmlRpc) */ ============================================================ --- sope-appserver/NGXmlRpc/WODirectAction+XmlRpcIntrospection.h 044c33b2edcca8efb074f5004fc501b091724db1 +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_WODirectAction_XmlRpcIntrospection_H__ -#define __NGXmlRpc_WODirectAction_XmlRpcIntrospection_H__ - -#include "WODirectAction+XmlRpc.h" - -@interface WODirectAction(XmlRpcIntrospection) - -- (NSArray *)system_listMethodsAction; -- (NSArray *)system_methodSignatureAction:(NSString *)_xmlrpcMethod; -- (NSString *)system_methodHelpAction:(NSString *)_xmlrpcMethod; - -@end - -#endif /* __NGXmlRpc_WODirectAction_XmlRpcIntrospection_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/WODirectAction+XmlRpcIntrospection.m 60bb76bea4b82cd7c3fe9c43692c25347718b275 +++ /dev/null @@ -1,305 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WODirectAction+XmlRpcIntrospection.h" -#include "WODirectAction+XmlRpc.h" -#include "NSObject+Reflection.h" -#include -#include -#include -#include "common.h" - -@interface NSMethodSignature(XmlRpcSignature) - -- (NSArray *)xmlRpcSignature; - -@end - -@implementation NSMethodSignature(XmlRpcSignature) - -- (NSString *)xmlRpcTypeForObjCType:(const char *)_type { - if (_type == NULL) return nil; -#if GNU_RUNTIME - switch (*_type) { - case _C_ID: - case _C_CLASS: - return @"string"; - - case _C_SEL: - case _C_CHARPTR: - return @"string"; - - case _C_CHR: - case _C_UCHR: - return @"boolean"; - - case _C_INT: - case _C_UINT: - case _C_SHT: - case _C_USHT: - case _C_LNG: - case _C_ULNG: - return @"i4"; - - case _C_ARY_B: - return @"array"; - case _C_STRUCT_B: - return @"struct"; - - case _C_FLT: - case _C_DBL: - return @"double"; - } -#endif - return @"string"; -} - -- (NSArray *)xmlRpcSignature { - NSMutableArray *signature; - unsigned i; - - signature = [NSMutableArray arrayWithCapacity:8]; - - /* return value */ - [signature addObject:[self xmlRpcTypeForObjCType:[self methodReturnType]]]; - - /* arguments */ - for (i = 2; i < [self numberOfArguments]; i++) { - const char *t; - - t = [self getArgumentTypeAtIndex:i]; - [signature addObject:[self xmlRpcTypeForObjCType:t]]; - } - - return signature; -} - -@end /* NSMethodSignature(XmlRpcSignature) */ - -@implementation WODirectAction(XmlRpcIntrospection) - -static NSArray *blacklist = nil; - -- (NSArray *)system_listMethodsAction { - NSMutableArray *ma; - NSEnumerator *sels; - NSString *sel; - NSString *namespace; - NSArray *selectors; - - namespace = [self xmlrpcComponentNamespace]; - - if (blacklist == nil) { - blacklist = [[NSArray alloc] initWithObjects:@"RPC2Action", - @"RPC2InfoPageAction", - @"xmlrpcAction", - @"commitFailedAction", - @"WOStatsAction", - @"defaultAction", - @"missingAuthAction", - @"selectorForXmlRpcAction:", - @"accessDeniedAction",nil]; - } - - selectors = [self respondsToSelectors]; - sels = [selectors objectEnumerator]; - - ma = [NSMutableArray arrayWithCapacity:[selectors count]]; - - while ((sel = [sels nextObject])) { - unsigned idx, len; - NSString *actionName; - NSRange rng; - - if ([blacklist containsObject:sel]) - continue; - - rng = [sel rangeOfString:@"Action"]; - if (rng.length <= 0) continue; - - /* strip Action */ - actionName = [sel substringToIndex:rng.location]; - - /* ensure that only dots are following the 'Action' */ - for (idx = (rng.location + rng.length), len = [sel length]; - idx < len; idx++) { - unichar c = [sel characterAtIndex:idx]; - if (c != ':') { - actionName = nil; - break; - } - } - - /* go to next selector if ... */ - if (![actionName isNotEmpty]) continue; - - /* make action name XMLRPC-style friendly */ - actionName = [actionName stringByReplacingString:@"_" withString:@"."]; - - if (namespace == nil) - [ma addObject:actionName]; - else { - /* add to reflection set */ - if ([actionName hasPrefix:@"system."]) - [ma addObject:actionName]; - else { - NSString *s; - - s = [[NSString alloc] initWithFormat:@"%@.%@", namespace,actionName]; - [ma addObject:s]; - [s release]; - } - } - } - - return [[[ma copy] autorelease] sortedArrayUsingSelector: - @selector(caseInsensitiveCompare:)]; -} - -- (NSArray *)system_methodSignatureAction:(NSString *)_xmlrpcMethod { - /* - It returns an array of possible signatures for this method. A signature - is an array of types. The first of these types is the return type of the - method, the rest are parameters. - - Multiple signatures (ie. overloading) are permitted: this is the reason - that an array of signatures are returned by this method. - - Signatures themselves are restricted to the top level parameters expected - by a method. For instance if a method expects one array of structs as a - parameter, and it returns a string, its signature is simply - "string, array". If it expects three integers, its signature is - "string, int, int, int". - - If no signature is defined for the method, a none-array value is returned. - */ - NSMutableArray *signatures; - NSString *actionName; - NSEnumerator *sels; - NSString *sel; - unsigned len; - Class clazz; - - clazz = [self class]; - signatures = [NSMutableArray arrayWithCapacity:4]; - actionName = [self selectorForXmlRpcAction:_xmlrpcMethod]; - - len = [actionName length]; - - sels = [[self respondsToSelectors] objectEnumerator]; - while ((sel = [sels nextObject])) { - NSArray *signature; - NSMethodSignature *ms; - - if (![sel hasPrefix:actionName]) continue; - - ms = [self methodSignatureForSelector:NSSelectorFromString(sel)]; - if (ms) { - signature = [ms xmlRpcSignature]; - } - else { - [self logWithFormat:@"missing Objective-C method signature for %@ ...", - sel]; - signature = nil; - } - - if (signature) - [signatures addObject:signature]; - } - - return [signatures isNotEmpty] - ? signatures - : (NSMutableArray *)[NSNumber numberWithBool:NO]; -} - -- (NSString *)system_methodHelpAction:(NSString *)_xmlrpcMethod { - return - @"Note: the Objective-C runtime cannot return the correct XML-RPC type " - @"for object parameters automatically (only for base types ...)."; -} - -@end /* WODirectAction(XmlRpcIntrospection) */ - - -#include - -@implementation WODirectAction(XmlRpcInfo) - -- (id)RPC2InfoPageAction { - WOResponse *r; - NSEnumerator *e; - id tmp; - - r = [WOResponse alloc]; - r = [[r initWithRequest:[self request]] autorelease]; - [r setHeader:@"text/html" forKey:@"content-type"]; - - [r appendContentString:@"WebService at "]; - [r appendContentHTMLString:[[self request] uri]]; - [r appendContentString:@""]; - - [r appendContentString:@"

WebService at "]; - [r appendContentHTMLString:[[self request] uri]]; - [r appendContentString:@"

"]; - - [r appendContentString:@"

methods

"]; - - [r appendContentString:@"\n"]; - [r appendContentString: - @"\n"]; - - e = [[self system_listMethodsAction] objectEnumerator]; - while ((tmp = [e nextObject])) { - NSString *mname, *info; - id sig; - - mname = [tmp stringValue]; - [r appendContentString:@""]; - - [r appendContentString:@""]; - - sig = [self system_methodSignatureAction:mname]; - info = [self system_methodHelpAction:mname]; - - [r appendContentString:@""]; - - if ([info isNotEmpty]) { - [r appendContentString:@""]; - } - - [r appendContentString:@"\n"]; - } - [r appendContentString:@"
namesignatureinfo
"]; - [r appendContentHTMLString:mname]; - [r appendContentString:@""]; - if ([sig isKindOfClass:[NSArray class]]) { - [r appendContentHTMLString:[sig stringValue]]; - } - [r appendContentString:@""]; - [r appendContentString:info]; - [r appendContentString:@"
"]; - - [r appendContentString:@""]; - - return r; -} - -@end /* WODirectAction(XmlRpcInfo) */ ============================================================ --- sope-appserver/NGXmlRpc/WOMessage+XmlRpcCoding.m b48fd59b0ba20072d22c8d9efae715d55777e9dc +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include -#include "common.h" - -@implementation WOMessage(XmlRpcCoding) - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [_coder encodeString:[self httpVersion] forKey:@"http-version"]; - [_coder encodeStruct:[self headers] forKey:@"headers"]; - [_coder encodeBase64:[self content] forKey:@"content"]; - [_coder encodeArray:[self cookies] forKey:@"cookies"]; -} - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - if ((self = [super init])) { - NSArray *cooks = [_coder decodeArrayForKey:@"cookies"]; - NSEnumerator *cookEnum = [cooks objectEnumerator]; - WOCookie *cook = nil; - - while ((cook = [cookEnum nextObject])) { - [self addCookie:cook]; - } - [self setHTTPVersion:[_coder decodeStringForKey:@"http-version"]]; - [self setHeaders: [_coder decodeStructForKey:@"headers"]]; - [self setContent: [_coder decodeBase64ForKey:@"content"]]; - - return self; - } - return nil; -} - -@end /* WOMessage(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/WORequest+XmlRpcCoding.m cae9f6cf67da7c476c0aacc001b4e7833d6cf957 +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include "common.h" -#include - -@implementation WORequest(XmlRpcCoding) - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [super encodeWithXmlRpcCoder:_coder]; - [_coder encodeString:[self method] forKey:@"method"]; - [_coder encodeString:[self uri] forKey:@"uri"]; -} - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - if ((self = [self initWithMethod:[_coder decodeStringForKey:@"method"] - uri:[_coder decodeStringForKey:@"uri"] - httpVersion:[_coder decodeStringForKey:@"http-version"] - headers:[_coder decodeStructForKey:@"headers"] - content:[_coder decodeBase64ForKey:@"content"] - userInfo:nil])) { - NSArray *cooks = [_coder decodeArrayForKey:@"cookies"]; - NSEnumerator *cookEnum = [cooks objectEnumerator]; - WOCookie *cook = nil; - - while ((cook = [cookEnum nextObject])) { - [self addCookie:cook]; - } - return self; - } - return nil; -} - -@end /* WORequest(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/WOResponse+XmlRpcCoding.m 312c546e1d56a2a45833d95eef4d06b9a8edbef3 +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include "common.h" -#include -#include - -@interface WOMessage(UsedPrivates) -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder; -@end - -@implementation WOResponse(XmlRpcCoding) - -- (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder { - [super encodeWithXmlRpcCoder:_coder]; - [_coder encodeInt:[self status] forKey:@"status"]; -} - -- (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder { - if ((self = [super initWithXmlRpcCoder:_coder])) { - [self setStatus:[_coder decodeIntForKey:@"status"]]; - } - return self; -} - -@end /* WOResponse(XmlRpcCoding) */ ============================================================ --- sope-appserver/NGXmlRpc/XmlRpcMethodCall+WO.h 8a89d65ed14a0bed3d1099bdcbb282c6c72b6159 +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SkyXmlRpcServer__XmlRpcMethodCall_WO_H__ -#define __SkyXmlRpcServer__XmlRpcMethodCall_WO_H__ - -#include - -@class WORequest; - -@interface XmlRpcMethodCall(WO) - -- (id)initWithRequest:(WORequest *)_request; -- (WORequest *)generateRequestWithUri:(NSString *)_uri; - -@end - -#endif /* __SkyXmlRpcServer__XmlRpcMethodCall_WO_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/XmlRpcMethodCall+WO.m 0dc6d4d67f17198df69cdbe6460697dd7511b087 +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include "common.h" - -@implementation XmlRpcMethodCall(WO) - -// TODO: not required anymore by NGXmlRpcClient, can be removed ? - -- (id)initWithRequest:(WORequest *)_request { - /* do not use -initWithXmlRpcString here !!! */ - return [self initWithXmlRpcData:[_request content]]; -} - -- (WORequest *)generateRequestWithUri:(NSString *)_uri { - WORequest *request; - - request = [[WORequest alloc] initWithMethod:@"POST" - uri:_uri - httpVersion:@"HTTP/1.0" - headers:nil - content:nil - userInfo:nil]; - - [request setHeader:@"text/xml" forKey:@"content-type"]; - [request setContentEncoding:NSUTF8StringEncoding]; - - [request appendContentString:[self xmlRpcString]]; - - return [request autorelease]; -} - -@end /* XmlRpcMethodCall(WO) */ ============================================================ --- sope-appserver/NGXmlRpc/XmlRpcMethodResponse+WO.h 945ea7834b5649b4c39122f371cf4ed50d7cf66c +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __XmlRpcMethodResponse_WO_H__ -#define __XmlRpcMethodResponse_WO_H__ - -#include -#include - -@class WOResponse; - -@interface XmlRpcMethodResponse(WO) < WOActionResults > - -- (id)initWithResponse:(WOResponse *)_response; -- (WOResponse *)generateResponse; - -@end - -#endif /* __XmlRpcMethodResponse_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/XmlRpcMethodResponse+WO.m d5fc487c046b14e8d76554c434914be37aefbada +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include -#include "common.h" - -@implementation XmlRpcMethodResponse(WO) - -// TODO: not required anymore by NGXmlRpcClient, can be removed ? - -- (id)initWithResponse:(WOResponse *)_response { - /* - should be based on NSData, so that the XML parser can decide the string - encoding (based on the declaration) ! - */ - NSString *xmlRpcString; - - xmlRpcString = [[NSString alloc] initWithData:[_response content] - encoding:[_response contentEncoding]]; - - self = [self initWithXmlRpcString:xmlRpcString]; - [xmlRpcString release]; - return self; -} - -- (WOResponse *)generateResponse { - WOResponse *response; - - response = [[[WOResponse alloc] init] autorelease]; - [response setStatus:200]; - [response setHTTPVersion:@"HTTP/1.0"]; - [response setContentEncoding:NSUTF8StringEncoding]; - [response setHeader:@"text/xml" forKey:@"content-type"]; - [response appendContentString:[self xmlRpcString]]; - return response; -} - -@end /* XmlRpcMethodResponse(WO) */ ============================================================ --- sope-appserver/NGXmlRpc/common.h a1e8d4efbce6164ec2526edd7eec8b908916a3d1 +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGXmlRpc_common_H__ -#define __NGXmlRpc_common_H__ - -#import - -#if NeXT_Foundation_LIBRARY || APPLE_FOUNDATION_LIBRARY -# include -# include -#endif - -#include -#include - -#include -#include - -@interface NSObject(NGXmlRpc_LastException) -- (NSException *)lastException; -@end - -#endif /* __NGXmlRpc_common_H__ */ ============================================================ --- sope-appserver/NGXmlRpc/fhs.make 3c247cdc9b9f7989b1b1a717781bee38eb66d1ed +++ /dev/null @@ -1,47 +0,0 @@ -# postprocessing - -# FHS support (this is a hack and is going to be done by gstep-make!) - -ifneq ($(FHS_INSTALL_ROOT),) - -FHS_INCLUDE_DIR=$(FHS_INSTALL_ROOT)/include/ -FHS_BIN_DIR=$(FHS_INSTALL_ROOT)/bin/ - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib64/ -else -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ -endif - -NONFHS_LIBDIR="$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)/" -NONFHS_LIBNAME="$(LIBRARY_NAME)$(LIBRARY_NAME_SUFFIX)$(SHARED_LIBEXT)" -NONFHS_BINDIR="$(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)" - - -fhs-header-dirs :: - $(MKDIRS) $(FHS_INCLUDE_DIR)$(libNGXmlRpc_HEADER_FILES_INSTALL_DIR) - -fhs-bin-dirs :: - $(MKDIRS) $(FHS_BIN_DIR) - - -move-headers-to-fhs :: fhs-header-dirs - @echo "moving headers to $(FHS_INCLUDE_DIR) .." - mv $(GNUSTEP_HEADERS)$(libNGXmlRpc_HEADER_FILES_INSTALL_DIR)/*.h \ - $(FHS_INCLUDE_DIR)$(libNGXmlRpc_HEADER_FILES_INSTALL_DIR)/ - -move-libs-to-fhs :: - @echo "moving libs to $(FHS_LIB_DIR) .." - mv $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ - -move-tools-to-fhs :: fhs-bin-dirs - @echo "moving tools from $(NONFHS_BINDIR) to $(FHS_BIN_DIR) .." - for i in $(TOOL_NAME); do \ - mv "$(NONFHS_BINDIR)/$${i}" $(FHS_BIN_DIR); \ - done - -move-to-fhs :: move-headers-to-fhs move-libs-to-fhs move-tools-to-fhs - -after-install :: move-to-fhs - -endif ============================================================ --- sope-appserver/PROJECTLEAD 8a7fbe37de2808c9a519a7b8f348e1399e280d38 +++ /dev/null @@ -1 +0,0 @@ -PROJECTLEAD=helge.hess@opengroupware.org ============================================================ --- sope-appserver/SoOFS/ChangeLog a031e361c4c8edbc992e29b75ad6a39600a46ed8 +++ /dev/null @@ -1,292 +0,0 @@ -2006-12-31 Marcus Mueller - - * v4.5.25 - - * OFSResourceManager.m: try to locate component class in runtime, - according to the name of the template. If that cannot be found, - fall back to WOComponent. - - * sope.m: accept --bundle commandline parameters for loading - custom classes, i.e. custom component classes. - -2006-12-30 Marcus Mueller - - * OFSResourceManager.m: assign self as resourceManager to components - created by it. (v4.5.24) - - * sope.m: changed to use the new user defaults registration mechanism - of WOCoreApplication (v4.5.23) - -2006-07-03 Helge Hess - - * use %p for pointer formats, fixed gcc 4.1 warnings (v4.5.22) - -2006-04-27 Marcus Mueller - - * OFSPropertyListObject.m: removed workaround for gstep-base KVC - problem - this has been fixed in gstep-base svn trunk (4.5.21) - -2006-04-08 Marcus Mueller - - * OFSPropertyListObject.m: added a workaround for a current gstep-base - KVC problem (4.5.20) - -2005-09-18 Helge Hess - - * GNUmakefile.preamble: added dependency to NGMail (v4.5.19) - -2005-08-06 Helge Hess - - * OFSResourceManager.m, OFSFolderDataSource.m, OFSPropertyListObject.m: - fixed gcc 4.0 warnings (v4.5.18) - -2005-07-23 Sebastian Reitenbach - - * GNUmakefile.preamble: added OpenBSD linking flags (v4.5.17) - -2005-05-03 Helge Hess - - * GNUmakefile.preamble: added strict bundle dependencies for MacOSX - (v4.5.16) - -2005-02-17 Marcus Mueller - - * v4.5.15 - - * sope.m: slightly adjusted #include's, sope.m now builds with Xcode - as well - - * SoOFS.xcode: added sope-4.5 tool target - -2005-01-04 Helge Hess - - * common.h: streamline NeXT/APPLE/COCOA Foundation library define into - just COCOA_Foundation_LIBRARY (fixes a warning) (v4.5.14) - -2005-01-04 Marcus Mueller - - * OFSWebMethodRenderer.m, OFSWebMethod.m, common.h: removed warnings - that occured during Xcode compile by explicitly declaring used - private interfaces (v4.5.14) - - * v4.5.13 - - * SoOFS.xcode: new product - - * SoOFS-Info.plist: updated properly - - * GNUmakefile.preamble: adjusted include paths, this way it works in - Xcode also without major changes. - - * common.h: safeguarded against double inclusion. Adjusted #include - paths - - * OFSFactoryRegistry.m, OFSHttpPasswd.m, OFSWebMethodRenderer.m, - OFSWebMethod.m, OFSFileRenderer.m, OFSPropertyListObject.m: adjusted - #include path. - -2004-11-04 Helge Hess - - * use Version file for install directory location - -2004-10-12 Helge Hess - - * sope.m: minor logging improvements (v4.3.12) - -2004-09-29 Helge Hess - - * fhs.make: install 'sope' tool in FHS sbin (v4.3.11) - -2004-09-27 Helge Hess - - * GNUmakefile: made 'sope' executable a versioned tool (now called - sope-4.3) (v4.3.10) - -2004-09-10 Helge Hess - - * GNUmakefile: fixed soname, libname versions (v4.3.9) - -2004-08-31 Helge Hess - - * GNUmakefile.preamble: fixed libNGMime location for gstep-make 1.9.2, - fixed library locations for FHS (v4.3.8) - -2004-08-29 Helge Hess - - * added hack to install the project in FHS locations - the library, - its headers, the tools and the resources will be installed in - FHS_INSTALL_ROOT if specified (eg make FHS_INSTALL_ROOT=/usr/local) - (v4.3.7) - -2004-08-29 Helge Hess - - * OFSResourceManager.m: fixed include for WOComponentDefinition.h - (v4.3.6) - -2004-08-24 Helge Hess - - * install product in Library/SoProducts-4.3/ (v4.3.5) - - * install product in Library/SoProducts/4.3/ (v4.3.4) - -2004-08-23 Helge Hess - - * GNUmakefile.preamble: removed libjs linking path (v4.3.3) - - * GNUmakefile.preamble: link SoOFS product bundle against the library - to ensure that the class are available (v4.3.2) - -2004-08-22 Helge Hess - - * v4.3.1 - - * moved the SoOFS library/sope tool to a separate project - -2004-05-16 Marcus Mueller - - * SoOFS/SoOFS-SXP-Info.plist, SoObjects/SoCore-SXP-Info.plist: new - entries for Xcode build (v4.2.370) - -2004-04-30 Marcus Mueller - - * SoOFS/OFSFolderDataSource.m: didn't work at all when no qualifier - was set (v4.2.358) - -2004-02-10 Helge Hess - - * SoOFS/OFSFileRenderer.m: do not use -initWithTimeIntervalSince1970: - on MacOSX (deprecated in Cocoa) - -2003-10-31 Helge Hess - - * SoOFS/OFSFolder+SoDAV.m: fixed a warning - -2003-10-29 Helge Hess - - * SoOFS/OFSFolder+SoDAV.m: added capability to create collections - -2003-10-15 Helge Hess - - * SoOFS/OFSFolder.m: generalized authenticator lookup - - * SoOFS/OFSBaseObject.m: avoid endless recursions in - -authenticatorInContext: - -2003-10-11 Helge Hess - - * SoOFS: added a folder datasource class for querying contents of an - OFS folder and a "contentDataSource" method - - * SoOFS/OFSFile.m: moved renderer selection to - SoRequestDispatcherRules - - * SoOFS/product.plist: set default access of OFSImage and - OFSPropertyListObject to allow, so that acquisition works when we - lookup a template on the object - - * SoOFS/OFSResourceManager.m: improved debug logging in error cases - -2003-09-06 Marcus Mueller - - * SoOFS/OFSHttpPasswd.m: Include for crypt if on Apple - or FreeBSD. A quick glimpse revealed that the system gcc (3.2) on - FreeBSD 5.x doesn't define __FreeBSD__ which is most likely a bug - and should be reported. On FreeBSD 4.x everything's as expected. - -2003-08-04 Helge Hess - - * SoOFS/OFSHttpPasswd.m: include des.h instead of crypt.h on OpenBSD - (pointed out by Max Berger, thanks!) - -2003-05-31 Helge Hess - - * SoOFS/OFSFolder.m: fixed calculation of default-method URI when - given a URI with a query-string (v4.2.195) - -2003-05-30 Helge Hess - - * SoOFS/OFSWebMethod.m: added support for POSTs (calls takeValues on - the component before returning it) - -2003-05-26 Helge Hess - - * SoObjects/SoOFS: major fixes to "clientObject" handling - - * SoOFS: added OFSWebDocument, map 'xhtml' extension to OFSWebDocument - - * SoOFS: prepared classes for ChangeLog files and htpasswd files - - * SoOFS/OFSFactoryRegistry.m: allow file extensions to determine - folder factory, added exact-name support - -2003-05-23 Helge Hess - - * SoOFS: added methods to detect version control systems (v4.2.187) - - * SoOFS: added OFSWebTemplate handler for xtmpl templates - - * SoOFS/OFSResourceManager.m: uses -traverseKey with a subcontext to - acquire resources, added logging (SoOFSResourceManagerDebugEnabled) - -2003-05-21 Helge Hess - - * SoOFS/OFSFileRenderer.m: changed to be a fully compliant renderer, - now also does the actual rendering (moved in code from OFSFile) - - * SoOFS/OFSWebMethod.m: moved OFSWebMethodRenderer to separate file - - * SoOFS/OFSWebMethod.m: added specialized renderer for OFSWebMethod - -2003-05-10 Helge Hess - - * SoOFS/OFSFile.m: return self on GET, use a renderer - - * SoOFS/OFSFile.m: added support for HEAD, cleaned up rendering (still - needs more work ...) - - * SoOFS/OFSWebMethod.m: added OFSWebMethodDebugEnabled default to - trigger debug logging, fixed a bug in component caching - -2003-04-15 Helge Hess - - * added 'sope' tool for hosting SoOFS based SOPE applications - -2003-01-14 Helge Hess - - * SoOFS/OFSPropertyListObject.m: improved factory and -saveObject to be - able to deal with new objects - - * SoOFS/OFSFactoryContext, OFSFolder: added a context creation method - for objects that do not yet exist in the store - -2003-01-07 Helge Hess - - * SoOFS/OFSFactoryRegistry.m: added some code to allow SoClass'es - behave as factories (located using the extension manifest key) - - * SoOFS/OFSFolder.m: move factory method to a separate category - - * SoOFS/OFSResourceManager.m: fixed some compilation warnings - - * SoOFS/OFSBaseObject.m: return nil for unbound keys (OSX) - -2002-12-18 Helge Hess - - * SoOFS/OFSFolder.m: fixed a typo - -2002-12-11 Helge Hess - - * SoOFS/OFSFile.m: added a generic "writeState:" method - -2002-11-22 Helge Hess - - * SoOFS: cleanup of OFS storage system (v4.2.94) - -2002-11-17 Helge Hess - - * SoOFS: authenticator object is now local to the object and - acquired using the container (v4.2.81) - -2002-11-14 Helge Hess - - * added first version of SoOFS (v4.2.75) ============================================================ --- sope-appserver/SoOFS/GNUmakefile 4e5815fc9d56bc23f1c06d9d4fc5490509344b02 +++ /dev/null @@ -1,109 +0,0 @@ -# GNUstep makefile - -include ../../config.make -include $(GNUSTEP_MAKEFILES)/common.make -include ../Version -include ./Version - -# TODO: clash between bundle and libname! -ifneq ($(frameworks),yes) -LIBRARY_NAME = libSoOFS -else -FRAMEWORK_NAME = SoOFS -endif - - -libSoOFS_PCH_FILE = common.h -libSoOFS_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION) -libSoOFS_INSTALL_DIR=$(SOPE_SYSLIBDIR) -libSoOFS_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION) - -libSoOFS_HEADER_FILES_DIR = . -libSoOFS_HEADER_FILES_INSTALL_DIR = /SoOFS - -libSoOFS_HEADER_FILES = \ - SoOFS.h \ - OFSBaseObject.h \ - OFSFactoryContext.h \ - OFSFactoryRegistry.h \ - OFSFile.h \ - OFSFileRenderer.h \ - OFSFolder.h \ - OFSImage.h \ - OFSPropertyListObject.h \ - OFSResourceManager.h \ - OFSWebMethod.h \ - OFSWebMethodRenderer.h \ - OFSWebTemplate.h \ - OFSWebDocument.h \ - OFSHttpPasswd.h \ - OFSChangeLog.h \ - OFSFolderDataSource.h \ - -libSoOFS_OBJC_FILES = \ - OFSBaseObject.m \ - OFSFactoryContext.m \ - OFSFactoryRegistry.m \ - OFSFile.m \ - OFSFileRenderer.m \ - OFSFolder+SoDAV.m \ - OFSFolder.m \ - OFSFolderClassDescription.m \ - OFSImage.m \ - OFSPropertyListObject.m \ - OFSResourceManager.m \ - OFSWebMethod.m \ - OFSWebMethodRenderer.m \ - OFSWebTemplate.m \ - OFSWebDocument.m \ - OFSHttpPasswd.m \ - OFSChangeLog.m \ - OFSFolderDataSource.m \ - - -ifeq ($(frameworks),yes) -# framework support - -SoOFS_PCH_FILE = $(libSoOFS_PCH_FILE) -SoOFS_HEADER_FILES = $(libSoOFS_HEADER_FILES) -SoOFS_OBJC_FILES = $(libSoOFS_OBJC_FILES) SoOFSProduct.m -SoOFS_RESOURCE_FILES = product.plist Version -SoOFS_PRINCIPAL_CLASS = SoOFSProduct - -else - -# ----- SoCore product for SOPE core registrations - -BUNDLE_NAME = SoOFS -BUNDLE_EXTENSION = .sxp -BUNDLE_INSTALL_DIR = $(SOPE_PRODUCTS)/ - -SoOFS_OBJC_FILES = SoOFSProduct.m -SoOFS_RESOURCE_FILES = product.plist Version -SoOFS_PRINCIPAL_CLASS = SoOFSProduct - -endif - - -# ----- NGObjWeb tools - -SOPED_NAME=sope-$(MAJOR_VERSION).$(MINOR_VERSION) - -TOOL_NAME = $(SOPED_NAME) - -$(SOPED_NAME)_OBJC_FILES = sope.m -$(SOPED_NAME)_INSTALL_DIR = $(SOPE_ADMIN_TOOLS) - - --include GNUmakefile.preamble -ifneq ($(FHS_INSTALL_ROOT),) -GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include -endif -ifneq ($(frameworks),yes) -include $(GNUSTEP_MAKEFILES)/library.make -include $(GNUSTEP_MAKEFILES)/bundle.make -else -include $(GNUSTEP_MAKEFILES)/framework.make -endif -include $(GNUSTEP_MAKEFILES)/tool.make --include GNUmakefile.postamble ============================================================ --- sope-appserver/SoOFS/GNUmakefile.preamble 2173b2bbfcf5fc3adefe34822e238839c2bc47d8 +++ /dev/null @@ -1,91 +0,0 @@ -# compilation settings - -# TODO: need to fix COMPILE_FOR_GSTEP_MAKE? -ADDITIONAL_CPPFLAGS += -Wall -DCOMPILE_FOR_GSTEP_MAKE=1 -ADDITIONAL_OBJCFLAGS += -Wall -Wno-import -Wno-protocol - -SOPE_ROOT=../.. -CORE_ROOT=$(SOPE_ROOT)/sope-core - -ADDITIONAL_INCLUDE_DIRS += \ - -I. \ - -I.. \ - -I../NGObjWeb \ - -I$(CORE_ROOT) \ - -I$(CORE_ROOT)/NGStreams/ \ - -I$(CORE_ROOT)/NGExtensions \ - -I$(SOPE_ROOT)/sope-xml - - -ifneq ($(frameworks),yes) - -libSoOFS_LIBRARIES_DEPEND_UPON += \ - -lNGObjWeb \ - -lNGMime -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC - -$(SOPED_NAME)_TOOL_LIBS += \ - -lSoOFS -lNGObjWeb \ - -lNGMime -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC - -SoOFS_WOBUNDLE_LIBS += \ - -lSoOFS \ - -lNGObjWeb \ - -lNGMime \ - -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC -SoOFS_BUNDLE_LIBS += $(SoOFS_WOBUNDLE_LIBS) - -else - -SoOFS_LIBRARIES_DEPEND_UPON += \ - -framework NGObjWeb \ - -framework NGMime -framework NGMail \ - -framework NGStreams -framework NGExtensions -framework EOControl \ - -framework XmlRpc -framework DOM -framework SaxObjC - -$(SOPED_NAME)_TOOL_LIBS += \ - -framework SoOFS -framework NGObjWeb \ - -framework NGMime -framework NGMail \ - -framework NGStreams -framework NGExtensions -framework EOControl \ - -framework XmlRpc -framework DOM -framework SaxObjC - -endif - - -# library/framework search pathes - -DEP_DIRS = \ - . ../NGObjWeb \ - $(SOPE_ROOT)/sope-mime \ - $(SOPE_ROOT)/sope-mime/NGMail \ - $(SOPE_ROOT)/sope-core/NGStreams \ - $(SOPE_ROOT)/sope-core/NGExtensions \ - $(SOPE_ROOT)/sope-core/EOControl \ - $(SOPE_ROOT)/sope-xml/DOM \ - $(SOPE_ROOT)/sope-xml/XmlRpc \ - $(SOPE_ROOT)/sope-xml/SaxObjC - -ifneq ($(frameworks),yes) -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),\ - -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME)) -else -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) -endif - -# platform specific settings - -ifneq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd) -# OpenBSD does not require libcrypt -ifneq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin) -# and neither does MacOSX? ... -sope_TOOL_LIBS += -lcrypt -endif -endif - -ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd) -$(SOPED_NAME)_TOOL_LIBS += -liconv -endif ============================================================ --- sope-appserver/SoOFS/OFSBaseObject.h 8721c3b8461fe001c639b2c9ab4ee2748098b56c +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSBaseObject_H__ -#define __OFS_OFSBaseObject_H__ - -#import -#include - -/* - OFSBaseObject - - This is the base class for OFS objects. Every OFS object has at least - - a name - - a container (not retained !) - - a filemanager - - a storage path (relative to the filemanager) - - Note that filemanager and storage path should in no case be made available - to the web for security reasons ! - - The name is tracked in the child since it is required of URL construction - (to know the URI name the child was found with). -*/ - -@class NSString, NSException, NSClassDescription; -@class EOGlobalID; -@class WOContext; -@class SoClass; -@class OFSFactoryContext; - -@interface OFSBaseObject : NSObject -{ - id fileManager; - NSString *storagePath; - SoClass *soClass; - NSString *name; - id container; -} - -/* accessors */ - -- (id)fileManager; -- (NSString *)storagePath; -- (EOGlobalID *)globalID; - -- (BOOL)isCollection; -- (BOOL)hasChildren; -- (BOOL)doesExist; - -/* containment */ - -- (id)container; -- (NSString *)nameInContainer; -- (void)setContainer:(id)_container andName:(NSString *)_name; -- (NSException *)takeStorageInfoFromContext:(OFSFactoryContext *)_ctx; - -/* operations */ - -- (void)detachFromContainer; -- (BOOL)isAttachedToContainer; - -- (id)DELETEAction:(id)_ctx; - -/* instantiation */ - -- (id)awakeFromFetchInContext:(OFSFactoryContext *)_ctx; -- (id)awakeFromInsertionInContext:(OFSFactoryContext *)_ctx; - -/* WebDAV */ - -- (NSString *)davDisplayName; // returns NSFileSubject or -name - -/* key validations */ - -- (NSException *)validateForDelete; -- (NSException *)validateForInsert; -- (NSException *)validateForUpdate; -- (NSException *)validateForSave; - -/* security */ - -- (NSString *)ownerInContext:(id)_ctx; -- (id)authenticatorInContext:(id)_ctx; - -/* version control */ - -- (BOOL)isCvsControlled; -- (BOOL)isSvnControlled; - -@end - -#endif /* __OFS_OFSBaseObject_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSBaseObject.m a09306263054db3ddc98329a73cb6523abfeb662 +++ /dev/null @@ -1,278 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSBaseObject.h" -#include "OFSFactoryContext.h" -#include "OFSFolder.h" -#include "common.h" - -@implementation OFSBaseObject - -+ (int)version { - return 1; -} - -- (void)dealloc { - [self detachFromContainer]; - [self->name release]; - [self->fileManager release]; - [self->storagePath release]; - [self->soClass release]; - [super dealloc]; -} - -/* awake */ - -- (NSException *)takeStorageInfoFromContext:(OFSFactoryContext *)_ctx { - self->fileManager = [[_ctx fileManager] retain]; - self->storagePath = [[_ctx storagePath] copy]; - [self setContainer:[_ctx container] andName:[_ctx nameInContainer]]; - return nil; -} - -- (id)awakeFromFetchInContext:(OFSFactoryContext *)_ctx { - if (self->fileManager == nil || self->storagePath == nil) - [self logWithFormat:@"WARNING: object has no storage info !"]; - - return self; -} -- (id)awakeFromInsertionInContext:(OFSFactoryContext *)_ctx { - self->fileManager = [[_ctx fileManager] retain]; - self->storagePath = [[_ctx storagePath] copy]; - [self setContainer:[_ctx container] andName:[_ctx nameInContainer]]; - return self; -} - -/* accessors */ - -- (SoClass *)soClass { - if (self->soClass == nil) - return [super soClass]; - return self->soClass; -} - -- (id)fileManager { - return self->fileManager; -} -- (NSString *)storagePath { - return self->storagePath; -} -- (EOGlobalID *)globalID { - return [[self fileManager] globalIDForPath:[self storagePath]]; -} - -- (BOOL)isCollection { - return NO; -} -- (BOOL)hasChildren { - return [self isCollection]; -} -- (BOOL)doesExist { - return [[self fileManager] fileExistsAtPath:[self storagePath]]; -} - -/* containment */ - -- (id)container { - return self->container; -} -- (NSString *)nameInContainer { - return self->name; -} -- (void)setContainer:(id)_container andName:(NSString *)_name { - self->container = _container; - ASSIGNCOPY(self->name, _name); -} - -/* operations */ - -- (void)detachFromContainer { - self->container = nil; - [self->name release]; self->name = nil; -} -- (BOOL)isAttachedToContainer { - return self->container ? YES : NO; -} - -- (id)DELETEAction:(id)_ctx { - NSException *e; - id fm; - - if ((e = [self validateForDelete])) - return e; - - if ((fm = [self fileManager]) == nil) { - [self logWithFormat:@"missing filemanager for delete."]; - return [NSException exceptionWithHTTPStatus:500 /* server error */ - reason:@"missing filemanager for object ?!"]; - } - - if (![self doesExist]) - return [NSException exceptionWithHTTPStatus:404 /* not found */]; - - if ([fm removeFileAtPath:[self storagePath] handler:nil]) - /* nil means "everything OK" ;-) [for the WebDAV renderer] */ - return [NSNumber numberWithBool:YES]; - - if ([fm respondsToSelector:@selector(lastException)]) - return [fm lastException]; - - return [NSException exceptionWithHTTPStatus:500 /* server error */ - reason:@"filemanager couldn't remove file at path."]; -} - -/* KVC */ - -- (id)handleQueryWithUnboundKey:(NSString *)key { - // TODO: any drawbacks when doing this ? - return nil; -} - -- (id)valueForKey:(NSString *)_name { - /* map out some very private keys */ - unsigned nl; - unichar c; - - if ((nl = [_name length]) == 0) - return nil; - - c = [_name characterAtIndex:0]; - if ((c == 's') && (nl == 11)) { - if ([_name isEqualToString:@"storagePath"]) - /* do not allow KVC access to storage path */ - return nil; - } - else if ((c == 'f') && (nl == 11)) { - if ([_name isEqualToString:@"fileManager"]) - /* do not allow KVC access to filemanager */ - return nil; - } - - return [super valueForKey:_name]; -} - -/* key validations */ - -- (NSException *)validateForDelete { - return nil; -} -- (NSException *)validateForInsert { - return nil; -} -- (NSException *)validateForUpdate { - return nil; -} -- (NSException *)validateForSave { - return nil; -} - -/* WebDAV */ - -- (NSString *)davDisplayName { - NSString *s; - if ((s = [self valueForKey:@"NSFileSubject"])) return s; - return [self nameInContainer]; -} -- (id)davLastModified { - return [self valueForKey:NSFileModificationDate]; -} - -/* schema */ - -- (NSClassDescription *)soClassDescription { - return nil; -} - -/* security */ - -- (NSString *)ownerInContext:(id)_ctx { - /* ask container ... */ - id c; - - if ((c = [self container]) == nil) - return nil; - - if ([c respondsToSelector:@selector(ownerOfChild:inContext:)]) - return [c ownerOfChild:self inContext:_ctx]; - - if (c == self) - /* avoid endless recursion ... */ - return nil; - - return [c ownerInContext:_ctx]; -} - -- (id)authenticatorInContext:(id)_ctx { - /* ask container ... */ - id lContainer; - - if ((lContainer = [self container]) == nil) - return nil; - - if (lContainer == self) - /* avoid endless recursion ... */ - return nil; - - return [lContainer authenticatorInContext:_ctx]; -} - -/* version control */ - -- (BOOL)isCvsControlled { - return NO; -} -- (BOOL)isSvnControlled { - return NO; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { -#if DEBUG - return YES; -#else - return NO; -#endif -} -- (NSString *)loggingPrefix { - /* improve perf ... */ - NSString *n = [self nameInContainer]; - return [NSString stringWithFormat:@"0x%p[%@]:%@", - self, NSStringFromClass([self class]), - n != nil ? n : (NSString *)@"ROOT"]; -} - -/* description */ - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; - - if (self->storagePath) - [ms appendFormat:@" path=%@", self->storagePath]; - - [ms appendString:@">"]; - return ms; -} - -@end /* OFSBaseObject */ ============================================================ --- sope-appserver/SoOFS/OFSChangeLog.h df5f58c201a3d85695946ff79cae69623a216c8d +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSChangeLog_H__ -#define __SoOFS_OFSChangeLog_H__ - -#include - -/* - OFSChangeLog - - This class is intended to wrap a ChangeLog text file. It should provide - web methods to view and edit ChangeLog information in a convenient way. -*/ - -@interface OFSChangeLog : OFSFile -{ -} - -@end - -#endif /* __SoOFS_OFSChangeLog_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSChangeLog.m 3d3e9699cf9a023258d3896d42134cbae0c45490 +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSChangeLog.h" -#include "common.h" - -@implementation OFSChangeLog - -// TODO: IMPLEMENT ;-) ! - -- (void)dealloc { - [super dealloc]; -} - -@end /* OFSChangeLog */ ============================================================ --- sope-appserver/SoOFS/OFSFactoryContext.h a708fbb8e3c577315b5f4b00b1071f76a3ada187 +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSFactoryContext_H__ -#define __OFS_OFSFactoryContext_H__ - -#import -#include - -/* - OFSFactoryContext - - The factory context is used to transport the instantiation environment - for OFS objects. -*/ - -@class NSString; -@class OFSFolder; - -@interface OFSFactoryContext : NSObject -{ -@public - id fileManager; - NSString *storagePath; - NSString *fileType; - NSString *mimeType; - NSString *name; - id container; - BOOL isNewObject; -} - -+ (OFSFactoryContext *)contextForChild:(NSString *)_name - storagePath:(NSString *)_sp - ofFolder:(OFSFolder *)_folder; -+ (OFSFactoryContext *)contextWithFileManager:(id)_fm - storagePath:(NSString *)_sp; - -+ (OFSFactoryContext *)contextForNewChild:(NSString *)_name - storagePath:(NSString *)_sp - ofFolder:(OFSFolder *)_folder; - -/* accessors */ - -- (id)fileManager; -- (NSString *)storagePath; -- (id)container; -- (NSString *)nameInContainer; - -- (NSString *)fileType; -- (NSString *)mimeType; - -- (BOOL)isNewObject; - -@end - -#endif /* __OFS_OFSFactoryContext_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFactoryContext.m c585d57a8b6be9d670ffaf53c87f75b7d61ecc09 +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFactoryContext.h" -#include "OFSFolder.h" -#include "common.h" - -@implementation OFSFactoryContext - -+ (OFSFactoryContext *)contextForChild:(NSString *)_name - storagePath:(NSString *)_sp - ofFolder:(OFSFolder *)_folder -{ - OFSFactoryContext *ctx; - - ctx = [[self alloc] init]; - ctx->fileManager = [[_folder fileManager] retain]; - ctx->storagePath = [_sp copy]; - ctx->container = [_folder retain]; - ctx->name = [_name copy]; - return [ctx autorelease]; -} -+ (OFSFactoryContext *)contextForNewChild:(NSString *)_name - storagePath:(NSString *)_sp - ofFolder:(OFSFolder *)_folder -{ - OFSFactoryContext *ctx; - - if ((ctx = [self contextForChild:_name storagePath:_sp ofFolder:_folder])) { - ctx->isNewObject = YES; - } - return ctx; -} - -+ (OFSFactoryContext *)contextWithFileManager:(id)_fm - storagePath:(NSString *)_sp -{ - OFSFactoryContext *ctx; - - ctx = [[self alloc] init]; - ctx->fileManager = [_fm retain]; - ctx->storagePath = [_sp copy]; - return [ctx autorelease]; -} - -- (void)dealloc { - [self->fileType release]; - [self->mimeType release]; - [self->fileManager release]; - [self->container release]; - [self->name release]; - [self->storagePath release]; - [super dealloc]; -} - -/* accessors */ - -- (id)fileManager { - return self->fileManager; -} -- (NSString *)storagePath { - return self->storagePath; -} -- (id)container { - return self->container; -} -- (NSString *)nameInContainer { - return self->name; -} - -- (NSString *)fileType { - return self->fileType; -} -- (NSString *)mimeType { - return self->mimeType; -} - -- (BOOL)isNewObject { - return self->isNewObject; -} - -/* description */ - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; - - if (self->isNewObject) - [ms appendString:@" NEW"]; - if (self->name) [ms appendFormat:@" create=%@", self->name]; - if (self->container) [ms appendFormat:@" in=%@", self->container]; - if (self->fileType) [ms appendFormat:@" type=%@", self->fileType]; - if (self->mimeType) [ms appendFormat:@" mime=%@", self->mimeType]; - if (self->storagePath) [ms appendFormat:@" path=%@", self->storagePath]; - - [ms appendString:@">"]; - return ms; -} - -@end /* OFSFactoryContext */ ============================================================ --- sope-appserver/SoOFS/OFSFactoryRegistry.h 8fb838695c2906b44ee48b3e8bc71bec85f051c3 +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSFactoryRegistry_H__ -#define __OFS_OFSFactoryRegistry_H__ - -#import - -/* - OFSFactoryRegistry - - The registry is responsible to select factories for producing objects - for either new objects or for unarchiving stored objects. - It's not the task of the registry to perform the creation itself. - - Note that the registry is usually not accessed directly, but rather - through OFSFolder. -*/ - -@class NSString, NSMutableDictionary; -@class SoClass; -@class OFSFactoryContext; - -@interface OFSFactoryRegistry : NSObject -{ - NSMutableDictionary *classToFileFactory; - NSMutableDictionary *extToFileFactory; - NSMutableDictionary *nameToFileFactory; - id defaultFolderFactory; - id defaultFileFactory; -} - -+ (id)sharedFactoryRegistry; - -/* lookup */ - -- (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx; -- (id)creationFactoryForContext:(OFSFactoryContext *)_ctx; - -/* registration */ - -- (void)registerFileFactory:(id)_factory forSoClass:(SoClass *)_clazz; -- (void)registerFileFactory:(id)_factory forClass:(Class)_clazz; - -- (void)registerFileFactory:(id)_factory forExtension:(NSString *)_ext; -- (void)registerFileFactory:(id)_factory forExactName:(NSString *)_name; - -@end - -#endif /* __OFS_OFSFactoryRegistry_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFactoryRegistry.m 32283baedadc0e9a3f5c41dd85e4360d9b9a13f7 +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFactoryRegistry.h" -#include "OFSFolder.h" -#include "OFSFile.h" -#include "OFSFactoryContext.h" -#include -#include -#include "common.h" - -@interface SoClass(Factory) -- (id)ofsObjectFactory; -@end - -@implementation OFSFactoryRegistry - -static int factoryDebugOn = 0; -static int factoryRegDebugOn = 0; - -+ (id)sharedFactoryRegistry { - static id reg = nil; - if (reg == nil) reg = [[OFSFactoryRegistry alloc] init]; - return reg; -} - -- (id)init { - if ((self = [super init])) { - self->classToFileFactory = - [[NSMutableDictionary alloc] initWithCapacity:32]; - self->extToFileFactory = - [[NSMutableDictionary alloc] initWithCapacity:64]; - self->nameToFileFactory = - [[NSMutableDictionary alloc] initWithCapacity:64]; - - self->defaultFolderFactory = [OFSFolder class]; - self->defaultFileFactory = [OFSFile class]; - } - return self; -} -- (void)dealloc { - [self->defaultFileFactory release]; - [self->defaultFolderFactory release]; - [self->classToFileFactory release]; - [self->extToFileFactory release]; - [self->nameToFileFactory release]; - [super dealloc]; -} - -/* lookup factory */ - -- (id)factoryForChildKey:(NSString *)_key - ofFolder:(OFSFolder *)_folder - fileType:(NSString *)_ftype - mimeType:(NSString *)_mimeType -{ - SoClassRegistry *classRegistry; - NSString *pe; - SoClass *soClass; - BOOL isDir; - id factory = nil; - - isDir = [_ftype isEqualToString:NSFileTypeDirectory] ? YES : NO; - - if (factoryDebugOn) { - [self debugWithFormat:@"lookup factory for key %@ type=%@ mime=%@", - _key, _ftype, _mimeType]; - } - - /* first check fixed child classes */ - - if (_folder && !isDir) { - factory = [self->classToFileFactory objectForKey:[_folder soClass]]; - if (factory) { - if (factoryDebugOn) { - [self debugWithFormat: - @"selected a file factory fixed to folderclass: %@", factory]; - } - return factory; - } - } - - /* then, check exact names (eg 'htpasswd') */ - - if ((factory = [self->nameToFileFactory objectForKey:_key])) { - if (factoryDebugOn) { - [self debugWithFormat:@"selected file factory by exact name '%@': %@", - _key, factory]; - } - return factory; - } - - /* now check extension */ - - pe = [_key pathExtension]; - if (pe == nil) pe = @""; - - if ((factory = [self->extToFileFactory objectForKey:pe])) { - if (factoryDebugOn) { - [self debugWithFormat:@"selected file factory by extension '%@': %@", - pe, factory]; - } - return factory; - } - - /* check for SoClass factories */ - - classRegistry = [SoClassRegistry sharedClassRegistry]; - - if ((soClass = [classRegistry soClassForExactName:_key])) { - if (factoryDebugOn) { - [self debugWithFormat:@"selected SoClass factory by exact name '%@': %@", - _key, factory]; - } - } - else if ((soClass = [classRegistry soClassForExtension:pe])) { - if (factoryDebugOn) { - [self debugWithFormat:@"selected SoClass factory by extension '%@': %@", - pe, factory]; - } - } - - if (soClass) { - if ((factory = [soClass ofsObjectFactory])) - return factory; - else { - if (factoryDebugOn) { - [self debugWithFormat: - @"did not use SoClass for name/extension %@/'%@': %@", - _key, pe, soClass]; - } - } - } - - /* apply defaults */ - - return isDir ? self->defaultFolderFactory : self->defaultFileFactory; -} - -- (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx { - return [self factoryForChildKey:[_ctx nameInContainer] - ofFolder:[_ctx container] - fileType:_ctx->fileType - mimeType:_ctx->mimeType]; -} -- (id)creationFactoryForContext:(OFSFactoryContext *)_ctx { - return [self factoryForChildKey:[_ctx nameInContainer] - ofFolder:[_ctx container] - fileType:_ctx->fileType - mimeType:_ctx->mimeType]; -} - -/* registration */ - -- (void)registerFileFactory:(id)_factory forSoClass:(SoClass *)_clazz { - if (_factory == nil) return; - if (_clazz == nil) return; - if (factoryRegDebugOn) { - [self debugWithFormat:@"registering file factory '%@' for class %@", - _factory, _clazz]; - } - [self->classToFileFactory setObject:_factory forKey:_clazz]; -} - -- (void)registerFileFactory:(id)_factory forClass:(Class)_clazz { - [self registerFileFactory:_factory forSoClass:[_clazz soClass]]; -} - -- (void)registerFileFactory:(id)_factory forExtension:(NSString *)_ext { - if (_factory == nil) return; - if (_ext == nil) return; - - if (factoryRegDebugOn) { - [self debugWithFormat:@"registering file factory '%@' for extension %@", - _factory, _ext]; - } - [self->extToFileFactory setObject:_factory forKey:_ext]; -} - -- (void)registerFileFactory:(id)_factory forExactName:(NSString *)_name { - if (_factory == nil) return; - if (_name == nil) return; - - if (factoryRegDebugOn) { - [self debugWithFormat:@"registering file factory '%@' for exact name '%@'", - _factory, _name]; - } - [self->nameToFileFactory setObject:_factory forKey:_name]; -} - -@end /* OFSFactoryRegistry */ - -@implementation SoClass(Factory) - -- (id)ofsObjectFactory { - return nil; -} - -@end /* SoClass(Factory) */ - -@implementation SoObjCClass(Factory) - -- (id)ofsObjectFactory { - Class bClazz; - - if ((bClazz = [self objcClass]) == Nil) - return nil; - - if (![bClazz respondsToSelector:@selector(instantiateInFactoryContext:)]) - return nil; - - return bClazz; -} - -@end /* SoObjCClass(Factory) */ ============================================================ --- sope-appserver/SoOFS/OFSFile.h 0682d5bcbf9f10339c8a946f2155808cec32c101 +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSFile_H__ -#define __OFS_OFSFile_H__ - -#include - -/* - OFSFile - - OFSFile represents file objects in OFS (child nodes, non-folders). Files - have a BLOB and can have associated meta-attributes (usually the filesystem - attributes given by the filemanager) - - OFSFile contains a basic implementation of WebDAV support methods and - properties. -*/ - -@class NSDictionary; -@class OFSFactoryContext; -@class WOContext; - -@interface OFSFile : OFSBaseObject -{ - NSDictionary *attrCache; -} - -/* writing content */ - -- (NSException *)writeState:(id)_value; -- (NSString *)contentAsString; - -/* implemented actions */ - -- (NSString *)contentTypeInContext:(WOContext *)_ctx; -- (id)GETAction:(WOContext *)_ctx; -- (id)viewAction:(WOContext *)_ctx; -- (id)PUTAction:(WOContext *)_ctx; - -/* factory */ - -+ (id)instantiateInFactoryContext:(OFSFactoryContext *)_ctx; - -@end - -#endif /* __OFS_OFSFile_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFile.m e718d7f7d78af4cd62cce9098accdc52d6d77a43 +++ /dev/null @@ -1,218 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFile.h" -#include "OFSFolder.h" -#include "OFSFactoryContext.h" -#include "OFSFileRenderer.h" -#include -#include "common.h" - -@implementation OFSFile - -+ (int)version { - return [super version] + 0 /* v1 */; -} -+ (void)initialize { - static BOOL didInit = NO; - if (!didInit) { - didInit = YES; - NSAssert2([super version] == 1, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - } -} - -- (void)dealloc { - [self->attrCache release]; - [super dealloc]; -} - -/* accessors */ - -- (BOOL)isCollection { - return NO; -} -- (BOOL)hasChildren { - return NO; -} - -- (NSStringEncoding)contentEncoding { - return [NSString defaultCStringEncoding]; -} - -- (NSString *)contentAsString { - NSData *data; - NSString *s; - - if ((data = [[self fileManager] contentsAtPath:[self storagePath]]) == nil) - return nil; - - s = [[NSString alloc] initWithData:data encoding:[self contentEncoding]]; - return [s autorelease]; -} - -/* writing content */ - -- (NSException *)writeState:(id)_value { - // TODO: better name: -writeContent:? - NSData *data; - id fm; - - if (_value == nil) { - return [NSException exceptionWithHTTPStatus:500 - reason:@"missing value to write !"]; - } - - // TODO: could support some more objects ? - if ([_value isKindOfClass:[NSData class]]) - data = _value; - else - data = [[_value stringValue] dataUsingEncoding:[self contentEncoding]]; - - fm = [self fileManager]; - if (![fm writeContents:data atPath:[self storagePath]]) { - if ([fm respondsToSelector:@selector(lastException)]) { - NSException *e = [fm lastException]; - [self logWithFormat:@"write of %i bytes failed: %@", [data length], e]; - return e; - } - - return [NSException exceptionWithHTTPStatus:500 - reason:@"could not write content, reason unknown"]; - } - - return nil; /* nil is OK */ -} - -/* attributes */ - -- (NSDictionary *)fileAttributes { - id fm; - - if ((fm = [self fileManager]) == nil) - return nil; - if (self->attrCache == nil) { - self->attrCache = - [[fm fileAttributesAtPath:[self storagePath] traverseLink:NO] copy]; - } - return self->attrCache; -} - -/* KVC */ - -- (BOOL)allowAccessToFileAttribute:(NSString *)_name { - return YES; -} - -- (id)valueForKey:(NSString *)_name { - unsigned nl; - unichar c; - - if ((nl = [_name length]) == 0) - return nil; - - c = [_name characterAtIndex:0]; - if (c == 'N' && (nl > 6)) { - if ([_name hasPrefix:@"NSFile"]) { - if ([self allowAccessToFileAttribute:_name]) - return [[self fileAttributes] objectForKey:_name]; - } - } - - return [super valueForKey:_name]; -} - -/* operations */ - -- (NSString *)contentTypeInContext:(WOContext *)_ctx { - NSString *ext, *type; - - type = nil; - if ((ext = [[self nameInContainer] pathExtension])) { - // TODO: read /etc/mime.types - if ([ext isEqualToString:@"html"]) type = @"text/html"; - else if ([ext isEqualToString:@"xhtml"]) type = @"text/xhtml"; - else if ([ext isEqualToString:@"gif"]) type = @"image/gif"; - else if ([ext isEqualToString:@"png"]) type = @"image/png"; - } - return type != nil ? type : (NSString *)@"application/octet-stream"; -} - -- (id)davContentLength { - return [[self fileAttributes] objectForKey:NSFileSize]; -} -- (NSDate *)davLastModified { - return [[self fileAttributes] objectForKey:NSFileModificationDate]; -} - -- (id)rendererForObject:(id)_object inContext:(WOContext *)_ctx { - return nil; -} - -- (id)viewAction:(WOContext *)_ctx { - return self; -} -- (id)GETAction:(WOContext *)_ctx { - return self; -} -- (id)HEADAction:(WOContext *)_ctx { - return self; -} - -- (id)PUTAction:(WOContext *)_ctx { - NSException *e; - NSData *content; - - if ((e = [self validateForSave])) { - [self debugWithFormat:@"object did not validate for save ..."]; - return e; - } - - if ((content = [[_ctx request] content]) == nil) - content = [NSData data]; - - if ((e = [self writeState:content])) - return e; - - return self; -} - -/* version control */ - -- (BOOL)isCvsControlled { - return [[self container] isCvsControlled]; -} -- (BOOL)isSvnControlled { - return [[self container] isSvnControlled]; -} - -/* factory */ - -+ (id)instantiateInFactoryContext:(OFSFactoryContext *)_ctx { - id object; - - object = [[self soClass] instantiateObject]; - [object takeStorageInfoFromContext:_ctx]; - return object; -} - -@end /* OFSFile */ ============================================================ --- sope-appserver/SoOFS/OFSFileRenderer.h 43571e192a311c82e9bc6e0f4b308ab3cb354719 +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSFileRenderer_H__ -#define __SoOFS_OFSFileRenderer_H__ - -#import - -/* - OFSFileRenderer - - Renders the actual contents of a file without any evaluation (eg used for - delivering images stored in OFS) -*/ - -@class NSException; -@class WOContext; - -@interface OFSFileRenderer : NSObject -{ -} - -+ (id)sharedRenderer; - -/* rendering */ - -- (NSException *)renderObject:(id)_object inContext:(WOContext *)_ctx; -- (BOOL)canRenderObject:(id)_object inContext:(WOContext *)_ctx; - -@end - -#endif /* __SoOFS_OFSFileRenderer_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFileRenderer.m 311fdb0be5fe64b87ea54bc5480c2f5cf2a7c369 +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFileRenderer.h" -#include "OFSFile.h" -#include -#include -#include -#include "common.h" - -@interface OFSFile(Render) - -- (id)davContentLength; -- (NSDate *)davLastModified; - -@end - -@implementation OFSFileRenderer - -static NSTimeZone *gmt = nil; - -+ (void)initialize { - gmt = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain]; -} - -+ (id)sharedRenderer { - static OFSFileRenderer *singleton = nil; - if (singleton == nil) - singleton = [[OFSFileRenderer alloc] init]; - return singleton; -} - -/* rendering */ - -- (NSException *)renderHeadOfObject:(id)_object inContext:(WOContext *)_ctx { - WOResponse *r; - id tmp; - - r = [_ctx response]; - - /* render headers */ - - if ((tmp = [_object contentTypeInContext:_ctx])) - [r setHeader:tmp forKey:@"content-type"]; - if ((tmp = [_object davContentLength])) - [r setHeader:tmp forKey:@"content-length"]; - - if ((tmp = [_object davLastModified])) { - NSCalendarDate *date; - -#if COCOA_Foundation_LIBRARY - date = [[NSCalendarDate alloc] initWithTimeIntervalSinceReferenceDate: - [tmp timeIntervalSinceReferenceDate]]; -#else - date = [[NSCalendarDate alloc] initWithTimeIntervalSince1970: - [tmp timeIntervalSince1970]]; -#endif - [date setTimeZone:gmt]; - - // "Tue, 10 Jul 2001 14:09:06 GMT" - tmp = [date descriptionWithCalendarFormat:@"%a, %d %b %Y %H:%M:%S GMT"]; - [date release]; - [r setHeader:tmp forKey:@"last-modified"]; - } - - return nil; -} - -- (NSException *)renderBodyOfObject:(id)_object inContext:(WOContext *)_ctx { - WOResponse *r; - NSData *content; - NSString *storePath; - id fm; - - fm = [_object fileManager]; - storePath = [_object storagePath]; - content = [fm contentsAtPath:storePath]; - - /* some error handling */ - - if (content == nil) { - // TODO: should render exception ? - if ([fm respondsToSelector:@selector(lastException)]) - return (id)[fm lastException]; - return [NSException exceptionWithHTTPStatus:404 /* not found */]; - } - - /* render body */ - r = [_ctx response]; - [r setContent:content]; - return nil; -} - -- (NSException *)renderObject:(id)_object inContext:(WOContext *)_ctx { - NSException *e; - - if ((e = [self renderHeadOfObject:_object inContext:_ctx])) - return e; - - if (![[[_ctx request] method] isEqualToString:@"HEAD"]) { - if ((e = [self renderBodyOfObject:_object inContext:_ctx])) - return e; - } - return nil; -} - -- (BOOL)canRenderObject:(id)_object inContext:(WOContext *)_ctx { - return [_object isKindOfClass:[OFSFile class]]; -} - -@end /* OFSFileRenderer */ ============================================================ --- sope-appserver/SoOFS/OFSFolder+SoDAV.m dfbd7d7282c9dad4321bb2b831e28322bcb1e053 +++ /dev/null @@ -1,160 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFolder.h" -#include "common.h" - -/* - Some special WebDAV keys: - .autodiskmounted - queried by the MacOSX DAV filesystem - .directory - queried by Nautilus - - both seem to work if the keys do not exist (no special handling required). -*/ - -@implementation OFSFolder(SoDAV) - -static int davDebugOn = 0; - -- (BOOL)davIsCollection { - return YES; -} -- (BOOL)davIsFolder { - /* this can be overridden by compound documents (aka filewrappers) */ - return [self davIsCollection]; -} - -- (BOOL)davHasSubFolders { - /* search for subfolders (tries to be smart and load as little as p. ;-) */ - NSArray *ak; - unsigned i, count; - - if ((ak = [self allKeys]) == nil) return NO; - if ((count = [ak count]) == 0) return NO; - - /* first scan the already loaded children */ - for (i = 0; i < count; i++) { - id child; - - child = [self->children objectForKey:[ak objectAtIndex:i]]; - if ([child davIsFolder]) return YES; - } - - /* now scan all children */ - - if (self->flags.didLoadAll) - return NO; /* we've already seen all children */ - [self allValues]; /* otherwise trigger a load */ - - for (i = 0; i < count; i++) { - id child; - - child = [self->children objectForKey:[ak objectAtIndex:i]]; - if ([child davIsFolder]) return YES; - } - - return NO; -} - -- (NSString *)fileExtensionForChildrenInContext:(id)_ctx { - /* - This can be used to enforce a common extension for all children, this is - useful for WebDAV directory listings (eg all children of an address folder - can appear as vcf files in cadaver or OSX). - */ - return nil; -} - -- (NSEnumerator *)davChildKeysInContext:(id)_ctx { - NSArray *keys; - NSString *ext; - unsigned len; - - keys = [self allKeys]; - if ((len = [keys count]) == 0) { - if (davDebugOn) - [self debugWithFormat:@"no DAV child keys for delivery ..."]; - return [keys objectEnumerator]; - } - - if ((ext = [self fileExtensionForChildrenInContext:_ctx])) { - NSMutableArray *ma; - unsigned i; - BOOL didChange; - - ma = [NSMutableArray arrayWithCapacity:len]; - didChange = NO; - for (i = 0; i < len; i++) { - NSString *k, *pe; - - k = [keys objectAtIndex:i]; - - if ((pe = [k pathExtension]) == nil) - [ma addObject:k]; - else if ([pe length] == 0) - [ma addObject:k]; - else { - k = [k stringByDeletingPathExtension]; - k = [k stringByAppendingPathExtension:ext]; - [ma addObject:k]; - didChange = YES; - } - } - if (didChange) keys = ma; - } - if (davDebugOn) { - [self debugWithFormat:@"DAV child keys for delivery: %@", - [keys componentsJoinedByString:@","]]; - } - return [keys objectEnumerator]; -} - -- (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx { - id fm; - NSString *p; - BOOL ok; - - if ([_name hasPrefix:@"."]) { - return [NSException exceptionWithHTTPStatus:405 /* not allowed */ - reason:@"creation of collections with a " - @"leading dot is not allowed."]; - } - - [self debugWithFormat:@"should create collection: %@", _name]; - - p = [[self storagePath] stringByAppendingPathComponent:_name]; - [self debugWithFormat:@" path for new collection: %@", p]; - - fm = [self fileManager]; - ok = [fm createDirectoryAtPath:p attributes:nil]; - if (!ok) { - [self debugWithFormat:@" could not created collection at: %@", p]; - return [NSException exceptionWithHTTPStatus:405 /* not allowed */ - reason: - @"this OFSFolder could not create the collection"]; - } - - [self debugWithFormat:@" created collection."]; - self->flags.didLoadAll = NO; /* not valid anymore */ - return nil; -} - -@end /* OFSFolder(SoDAV) */ ============================================================ --- sope-appserver/SoOFS/OFSFolder.h 15098159819a3dea28c4a1e35520b7382992b31b +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSFolder_H__ -#define __OFS_OFSFolder_H__ - -#include - -/* - OFSFolder - - OFSFolder's map to filesystem directories and are "collections" of other - OFS objects. OFSFolder's can also store custom properties in a special file - (.props.plist). - - How collections are loaded - ========================== - When an OFSFolder is loaded, it doesn't instantiate any of it child objects - (since this would result in a cascade sucking in all the filesystem below. - As long as OFSFolder isn't sent -allObjects, it isn't fully loaded, instead - the objects are stored in the children hash and loaded on demand when the key - is looked up. - - How child objects are instantiated - ================================== - An OFSFolder also acts as a factory for it's children since it needs to - unarchive them into memory. That is, it's the task of the folder to select - an appropriate class for the in-memory representation of a childresource. - - Security - ======== - The folder can manage the owner of the children and manages it's own - owner. The own owner is stored in the SoOwner field of the propertylist - and the children in the SoChildOwners field (which has to be a dictionary). -*/ - -@class NSArray, NSDictionary, NSMutableDictionary, NSString, NSEnumerator; -@class WOResourceManager; -@class SoClass; -@class OFSFactoryContext, OFSFactoryRegistry; - -@interface OFSFolder : OFSBaseObject -{ -@private - NSArray *childNames; - NSMutableDictionary *children; - NSDictionary *props; - struct { - BOOL didLoadAll:1; - BOOL hasCVS:1; - BOOL hasSvn:1; - BOOL checkedVersionSpecials:1; - int reserved:28; - } flags; - WOResourceManager *resourceManager; -} - -/* mimic a dictionary */ - -- (NSArray *)allKeys; -- (NSArray *)allValues; -- (BOOL)hasKey:(NSString *)_key; -- (id)objectForKey:(NSString *)_key; -- (NSEnumerator *)keyEnumerator; -- (NSEnumerator *)objectEnumerator; - -- (BOOL)isValidKey:(NSString *)_key; - -/* storage */ - -- (void)willChange; - -- (NSString *)storagePathForChildKey:(NSString *)_name; - -- (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx; -- (id)creationFactoryForContext:(OFSFactoryContext *)_ctx; - -- (NSException *)reload; - -/* actions */ - -- (NSString *)defaultMethodNameInContext:(id)_ctx; - -- (id)GETAction:(id)_ctx; -- (id)PUTAction:(id)_ctx; -- (id)MKCOLAction:(id)_ctx; -- (id)DELETEAction:(id)_ctx; - -/* security */ - -- (NSString *)ownerInContext:(id)_ctx; -- (NSString *)ownerOfChild:(id)_child inContext:(id)_ctx; - -/* WO integration */ - -- (WOResourceManager *)resourceManagerInContext:(id)_ctx; - -/* factory lookup */ - -- (OFSFactoryRegistry *)factoryRegistry; -- (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx; -- (id)creationFactoryForContext:(OFSFactoryContext *)_ctx; - -@end - -#endif /* __OFS_OFSFolder_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFolder.m 1dc3eb020ffab84fce444cac0575f4287bad537c +++ /dev/null @@ -1,938 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFolder.h" -#include "OFSFile.h" -#include "OFSFactoryContext.h" -#include "OFSFactoryRegistry.h" -#include "OFSResourceManager.h" -#include "OFSFolderClassDescription.h" -#include "OFSFolderDataSource.h" -#include -#include "common.h" - -@implementation OFSFolder - -static BOOL factoryDebugOn = NO; -static BOOL debugLookup = NO; -static BOOL debugRestore = NO; -static BOOL debugNegotiate = NO; -static BOOL debugAuthLookup = NO; - -+ (int)version { - return [super version] + 1 /* v2 */; -} -+ (void)initialize { - static BOOL didInit = NO; - if (!didInit) { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - didInit = YES; - NSAssert2([super version] == 1, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - - debugLookup = [ud boolForKey:@"SoDebugKeyLookup"]; - factoryDebugOn = [ud boolForKey:@"SoOFSDebugFactory"]; - debugRestore = [ud boolForKey:@"SoOFSDebugRestore"]; - debugNegotiate = [ud boolForKey:@"SoOFSDebugNegotiate"]; - debugAuthLookup = [ud boolForKey:@"SoOFSDebugAuthLookup"]; - } -} - -- (void)dealloc { - [(OFSResourceManager *)self->resourceManager invalidate]; - [self->resourceManager release]; - - [[self->children allValues] - makeObjectsPerformSelector:@selector(detachFromContainer)]; - - [self->childNames release]; - [self->props release]; - [self->children release]; - [super dealloc]; -} - -/* accessors */ - -- (NSString *)propertyFilename { - return @".props.plist"; -} - -- (BOOL)isCollection { - return YES; -} -- (BOOL)hasChildren { - return [self->childNames count] > 0 ? YES : NO; -} - -- (NSArray *)allKeys { - return self->childNames; -} - -- (BOOL)hasKey:(NSString *)_key { - return [self->childNames containsObject:_key]; -} - -- (id)objectForKey:(NSString *)_key { - OFSFactoryContext *ctx; - NSDictionary *fileAttrs; - NSString *fileType, *mimeType; - NSString *childPath; - id child; - id factory; - - if ((child = [self->children objectForKey:_key])) - /* cached */ - return [child isNotNull] ? child : nil; - - if ([_key hasPrefix:@"."]) - /* do not consider keys starting with a point ... */ - return nil; - - if (self->flags.didLoadAll) - /* everything is cached, should be in there .. */ - return nil; - - if (![self->childNames containsObject:_key]) - /* not a storage key anyway */ - return nil; - - /* find out filetype */ - - childPath = [self storagePathForChildKey:_key]; - fileAttrs = [[self fileManager] fileAttributesAtPath:childPath - traverseLink:YES]; - fileType = [fileAttrs objectForKey:NSFileType]; - mimeType = [fileAttrs objectForKey:@"NSFileMimeType"]; - - if (fileType == nil) - [self logWithFormat:@"got no file type for child %@ ...", _key]; - - /* create factory context */ - - ctx = [OFSFactoryContext contextForChild:_key - storagePath:childPath - ofFolder:self]; - ctx->fileType = [fileType copy]; - ctx->mimeType = [mimeType copy]; - - /* lookup factory */ - - if ((factory = [self restorationFactoryForContext:ctx]) == nil) { - [self logWithFormat:@"found no factory for key '%@' (%@, mime=%@)", - _key, fileType, mimeType]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"found no factory for object !"]; - } - - if (factoryDebugOn) - [self debugWithFormat:@"selected factory %@ for key %@", factory, _key]; - - /* instantiate and register */ - - if (self->children == nil) { - self->children = - [[NSMutableDictionary alloc] initWithCapacity:[self->childNames count]]; - } - - if ((child = [factory instantiateInFactoryContext:ctx]) == nil) { - [self logWithFormat:@"factory did not instantiate object for key '%@'", - _key]; - child = [NSException exceptionWithHTTPStatus:500 - reason:@"instantiation of object failed !"]; - } - - [self->children setObject:child forKey:_key]; - - /* awake object, handle possible replacement result */ - - if (![child isKindOfClass:[NSException class]]) { - id replacement; - - replacement = [child awakeFromFetchInContext:ctx]; - if (replacement != child) { - if (replacement == nil) - [self->children removeObjectForKey:_key]; - else - [self->children setObject:replacement forKey:_key]; - } - } - - return child; -} - -- (NSArray *)allValues { - NSEnumerator *keys; - NSString *key; - - if (self->flags.didLoadAll) - return [self->children allValues]; - - /* query each key to load it into the children cache */ - - keys = [self->childNames objectEnumerator]; - while ((key = [keys nextObject])) - [self objectForKey:key]; - - self->flags.didLoadAll = 1; - return [self->children allValues]; -} - -- (NSEnumerator *)keyEnumerator { - return [self->childNames objectEnumerator]; -} -- (NSEnumerator *)objectEnumerator { - return [[self allValues] objectEnumerator]; -} - -- (BOOL)isValidKey:(NSString *)_key { - /* - Check whether key is usable for storage (extract some FS sensitive or - private keys) - */ - unichar c; - if ([_key length] == 0) return NO; - c = [_key characterAtIndex:0]; - if (c == '.') return NO; - if (c == '~') return NO; - if (c == '%') return NO; - if (c == '/') return NO; - if ([_key rangeOfString:@"/"].length > 0) - // TBD: we should allow '/' in filenames - return NO; - if ([_key isEqualToString:[self propertyFilename]]) - return NO; - return YES; -} - -/* datasource */ - -- (EODataSource *)contentDataSource { - return [OFSFolderDataSource dataSourceOnFolder:self]; -} - -/* storage */ - -- (void)willChange { -} - -- (NSString *)storagePathForChildKey:(NSString *)_name { - if (![self isValidKey:_name]) return nil; - return [[self storagePath] stringByAppendingPathComponent:_name]; -} - -- (OFSFactoryRegistry *)factoryRegistry { - return [OFSFactoryRegistry sharedFactoryRegistry]; -} - -- (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx { - return [[self factoryRegistry] restorationFactoryForContext:_ctx]; -} -- (id)creationFactoryForContext:(OFSFactoryContext *)_ctx { - return [[self factoryRegistry] creationFactoryForContext:_ctx]; -} - -/* unarchiving */ - -- (NSClassDescription *)soClassDescription { - // TODO: cache class description ? - return [[[OFSFolderClassDescription alloc] initWithFolder:self] autorelease]; -} -- (NSArray *)attributeKeys { - return [self->props allKeys]; -} -- (NSArray *)toOneRelationshipKeys { - return [self allKeys]; -} - -- (void)filterChildNameArray:(NSMutableArray *)p { - unsigned i; - - [p removeObject:[self propertyFilename]]; - - for (i = 0; i < [p count];) { - NSString *k; - unsigned kl; - - k = [p objectAtIndex:i]; - kl = [k length]; - if (kl == 3 && !self->flags.hasCVS && [k isEqualToString:@"CVS"]) { - self->flags.hasCVS = 1; - [p removeObjectAtIndex:i]; - } - else if (kl == 4 && !self->flags.hasSvn && [k isEqualToString:@".svn"]) { - self->flags.hasSvn = 1; - [p removeObjectAtIndex:i]; - } - else if ([k hasPrefix:@"."]) - [p removeObjectAtIndex:i]; - else - i++; - } - self->flags.checkedVersionSpecials = 1; -} - -- (id)awakeFromFetchInContext:(OFSFactoryContext *)_ctx { - NSString *sp; - id p; - - if (debugRestore) - [self debugWithFormat:@"-awakeFromContext:%@", _ctx]; - - if ((p = [super awakeFromFetchInContext:_ctx]) != self) { - if (debugRestore) - [self debugWithFormat:@" parent replaced object with: %@", p]; - return p; - } - - sp = [_ctx storagePath]; - if (debugRestore) - [self debugWithFormat:@" restore path: '%@'", sp]; - - /* load the dictionary properties */ - - p = [sp stringByAppendingPathComponent:[self propertyFilename]]; - self->props = [[NSDictionary alloc] initWithContentsOfFile:p]; - - if (debugRestore) { - [self debugWithFormat:@" restored %i properties: %@", - [self->props count], - [[self->props allKeys] componentsJoinedByString:@","]]; - } - - /* load the collection children names */ - - p = [[[_ctx fileManager] directoryContentsAtPath:sp] mutableCopy]; - if (p == nil) { - [self debugWithFormat:@"couldn't get child names at path '%@'.", p]; - return nil; - } - if (debugRestore) - [self debugWithFormat:@" storage child names at '%@': %@", sp, p]; - - [self filterChildNameArray:p]; - [p sortUsingSelector:@selector(compare:)]; - - self->childNames = [p copy]; - [p release]; - - if (debugRestore) { - [self debugWithFormat:@" restored child names: %@", - [self->childNames componentsJoinedByString:@","]]; - } - - return self; -} - -- (void)flushChildCache { - [[self->children allValues] - makeObjectsPerformSelector:@selector(detachFromContainer)]; - [self->children removeAllObjects]; - self->flags.didLoadAll = 0; -} - -- (NSException *)reload { - // TODO: reload folder ! - [self flushChildCache]; - return nil; -} - -/* KVC */ - -- (id)valueForKey:(NSString *)_name { - /* map out some very private keys */ - unsigned nl; - unichar c; - NSString *v; - - if ((v = [self->props objectForKey:_name])) - return v; - - if ((nl = [_name length]) == 0) - return nil; - - c = [_name characterAtIndex:0]; - // TBD ? - - return [super valueForKey:_name]; -} - -/* operations */ - -- (BOOL)allowRecursiveDeleteInContext:(id)_ctx { - return NO; -} - -- (NSString *)defaultMethodNameInContext:(id)_ctx { - return @"index"; -} -- (id)lookupDefaultMethod { - id ctx = nil; - - ctx = [[WOApplication application] context]; - return [self lookupName:[self defaultMethodNameInContext:ctx] - inContext:ctx - acquire:YES]; -} - -- (id)GETAction:(id)_ctx { - WOResponse *r = [(id )_ctx response]; - NSString *uri, *qs, *method; - NSRange ra; - - if (![[_ctx soRequestType] isEqualToString:@"METHOD"]) - return self; - - if ((method = [self defaultMethodNameInContext:_ctx]) == nil) - /* no default method */ - return self; - - /* construct URI */ - - uri = [[(id )_ctx request] uri]; - ra = [uri rangeOfString:@"?"]; - if (ra.length > 0) { - qs = [uri substringFromIndex:ra.location]; - uri = [uri substringToIndex:ra.location]; - } - else - qs = nil; - uri = [uri stringByAppendingPathComponent:method]; - if (qs) uri = [uri stringByAppendingString:qs]; - - [r setStatus:302 /* moved */]; - [r setHeader:uri forKey:@"location"]; - return r; -} - -- (id)DELETEAction:(id)_ctx { - NSException *e; - - if ((e = [self validateForDelete])) - return e; - - if ([self hasChildren]) { - if (![self allowRecursiveDeleteInContext:_ctx]) { - return [NSException exceptionWithHTTPStatus:403 /* forbidden */ - reason:@"tried to delete a filled folder"]; - } - } - return [super DELETEAction:_ctx]; -} - -- (id)PUTAction:(id)_ctx { - OFSFactoryContext *ctx; - NSString *pathInfo; - NSString *childPath; - id factory; - id result, child; - id childPutMethod; - - pathInfo = [_ctx pathInfo]; - /* TODO: NEED TO REWRITE path info to a key (eg strip .vcf) ! */ - - // TODO: return conflict, on attempt to create subfolder - if ([pathInfo length] == 0) { - [self debugWithFormat:@"attempt to PUT to an OFSFolder !"]; - [self debugWithFormat:@"body:\n%@", [[(id )_ctx request] contentAsString]]; - - return [NSException exceptionWithHTTPStatus:405 /* method not allowed */ - reason:@"HTTP PUT not allowed on a folder resource"]; - } - - if ([self->childNames containsObject:pathInfo]) { - /* - Explained: PUT can be and is used to overwrite existing resources. But - if PUT was issued on an existing resource, the SoObject for this resource - will receive the PUT action, not it's contained. - So: the container (folder) only receives a PUT action with a PATH_INFO if - the resource to be PUT is new. - */ - [self debugWithFormat: - @"internal inconsistency, tried to create an existing resource !"]; - return [NSException exceptionWithHTTPStatus:500 /* method not allowed */ - reason:@"tried to create an existing resource"]; - } - - if ((childPath = [self storagePathForChildKey:pathInfo]) == nil) { - [self debugWithFormat:@"invalid name for child !"]; - return [NSException exceptionWithHTTPStatus:400 /* bad request */ - reason:@"the name for the child creation was invalid"]; - } - - /* create factory context */ - - ctx = [OFSFactoryContext contextForNewChild:pathInfo - storagePath:childPath - ofFolder:self]; - ctx->fileType = [NSFileTypeRegular retain]; - ctx->mimeType = [[[(id )_ctx request] headerForKey:@"content-type"] copy]; - - /* lookup factory */ - - if ((factory = [self creationFactoryForContext:ctx]) == nil) { - [self logWithFormat:@"found no factory for new key '%@' (%@, mime=%@)", - pathInfo, ctx->fileType, [ctx mimeType]]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"found no factory for new object !"]; - } - - if (factoryDebugOn) { - [self debugWithFormat:@"selected factory %@ for new child named %@", - factory, pathInfo]; - } - - /* instantiate and register */ - - if (self->children == nil) { - self->children = - [[NSMutableDictionary alloc] initWithCapacity:[self->childNames count]]; - } - - if ((child = [factory instantiateInFactoryContext:ctx]) == nil) { - [self logWithFormat: - @"factory did not instantiate new object for key '%@'", - pathInfo]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"instantiation of object failed !"]; - } - if ([child isKindOfClass:[NSException class]]) - return child; - - childPutMethod = [child lookupName:@"PUT" inContext:_ctx acquire:NO]; - if (childPutMethod == nil) { - return [NSException exceptionWithHTTPStatus:405 /* method not allowed */ - reason:@"new child does not support HTTP PUT."]; - } - - [self->children setObject:child forKey:pathInfo]; - - /* awake object, handle possible replacement result */ - - { - id replacement; - - replacement = [child awakeFromInsertionInContext:ctx]; - if (replacement != child) { - if ([replacement isKindOfClass:[NSException class]]) { - replacement = [replacement retain]; - [self->children removeObjectForKey:pathInfo]; - return [replacement autorelease]; - } - - if (replacement == nil) { - [self->children removeObjectForKey:pathInfo]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"awake failed, reason unknown"]; - } - else { - childPutMethod = - [replacement lookupName:@"PUT" inContext:_ctx acquire:NO]; - - if (childPutMethod == nil) { - [self->children removeObjectForKey:pathInfo]; - return [NSException exceptionWithHTTPStatus:405 /* not allowed */ - reason:@"new child does not support HTTP PUT."]; - } - - [self->children setObject:replacement forKey:pathInfo]; - child = replacement; - } - } - } - - /* now forward the PUT to the child */ - - result = [[childPutMethod bindToObject:child inContext:_ctx] - callOnObject:child inContext:_ctx]; - - /* check whether put was successful */ - - if ([result isKindOfClass:[NSException class]]) { - /* creation failed, unregister from childlist */ - [child detachFromContainer]; - [self->children removeObjectForKey:pathInfo]; - } - - return result; -} - -- (id)MKCOLAction:(id)_ctx { - NSString *pathInfo; - - pathInfo = [_ctx pathInfo]; - pathInfo = [pathInfo stringByUnescapingURL]; - - if ([pathInfo length] == 0) { - [self debugWithFormat:@"attempt to MKCOL an existint OFSFolder !"]; - return [NSException exceptionWithHTTPStatus:405 /* method not allowed */ - reason:@"tried MKCOL an an existing resource"]; - } - - // TBD: create new child - // TBD: return conflict, on attempt to create subfolder - return [NSException exceptionWithHTTPStatus:403 /* forbidden */ - reason:@"creating collections is forbidden"]; -} - -/* lookup */ - -- (NSString *)normalizeKey:(NSString *)_name inContext:(id)_ctx { - /* useful for content-negotiation */ - return _name; -} - -- (NSString *)selectBestMatchForName:(NSString *)_name - fromChildNames:(NSArray *)_matches - inContext:(id)_ctx -{ - NSString *storeName; - unsigned count; - - if ((count = [_matches count]) == 0) - storeName = nil; - else if (count == 1) - storeName = [_matches objectAtIndex:0]; - else { - // TODO: some real negotiation based on "accept", "language", .. - storeName = [_matches objectAtIndex:0]; - [self logWithFormat:@"negotiate: selected '%@' from: %@.", storeName, - [_matches componentsJoinedByString:@","]]; - } - if (debugNegotiate) [self logWithFormat:@"negotiated: '%@'", storeName]; - return storeName; -} - -- (NSString *)negotiateName:(NSString *)_name inContext:(id)_ctx { - /* returns a "storeName", one which can be resolved in the store */ - NSMutableArray *matches; - NSString *askedExt, *normName, *storeName; - NSArray *availKeys; - unsigned i, count; - - if (debugNegotiate) [self logWithFormat:@"negotiate: %@", _name]; - - availKeys = [self allKeys]; - if ((count = [availKeys count]) == 0) - return nil; /* no content */ - if ([availKeys containsObject:_name]) - return _name; /* exact match */ - - /* some hard-coded content negotiation */ - - askedExt = [_name pathExtension]; - normName = [_name stringByDeletingPathExtension]; - - for (i = 0, matches = nil; i < count; i++) { - NSString *storeName, *childNormName; - - storeName = [availKeys objectAtIndex:i]; - childNormName = [storeName stringByDeletingPathExtension]; - - if (debugNegotiate) [self logWithFormat:@" check: %@", storeName]; - - if (![normName isEqualToString:childNormName]) - /* does not match */ - continue; - - if (matches == nil) matches = [[NSMutableArray alloc] initWithCapacity:16]; - [matches addObject:storeName]; - } - - if (matches == nil) - return nil; /* no matches */ - - storeName = [self selectBestMatchForName:normName - fromChildNames:matches - inContext:_ctx]; - storeName = [[storeName copy] autorelease]; - [matches release]; - return storeName; -} - -- (BOOL)hasName:(NSString *)_name inContext:(id)_ctx { - _name = [self normalizeKey:_name inContext:_ctx]; - - if ([self hasKey:_name]) - /* is a stored key ! */ - return YES; - - /* queried something else */ - return [super hasName:_name inContext:_ctx]; -} - -- (NSException *)validateName:(NSString *)_name inContext:(id)_ctx { - return [super validateName:[self normalizeKey:_name inContext:_ctx] inContext:_ctx]; -} - -- (id)lookupStoredName:(NSString *)_name inContext:(id)_ctx { - NSString *storeName; - - if ((storeName = [self negotiateName:_name inContext:_ctx]) == nil) - return nil; - - /* is a stored key ! */ - return [self objectForKey:storeName]; -} - -- (id)handleMissingName:(NSString *)_name inContext:(id)_ctx { - // TODO: object autocreation support (aka "create on access") - if (debugLookup) - [self debugWithFormat:@" found no matching value for key: %@", _name]; - return nil; -} - -- (id)lookupName:(NSString *)_name inContext:(id)_ctx acquire:(BOOL)_flag { - id value; - - if (debugLookup) [self debugWithFormat:@"lookup key '%@'", _name]; - - /* normalize key */ - - _name = [self normalizeKey:_name inContext:_ctx]; - if (debugLookup) - [self debugWithFormat:@" normalized '%@'", _name]; - - /* lookup in folder storage */ - - if ((value = [self lookupStoredName:_name inContext:_ctx])) { - /* found an SoOFS child in storage */ - if (debugLookup) [self debugWithFormat:@" stored value: %@", value]; - return value; - } - - if (debugLookup) { - [self debugWithFormat:@" not a collection child: %@", - [[self allKeys] componentsJoinedByString:@","]]; - } - - /* queried something else */ - if ((value = [super lookupName:_name inContext:_ctx acquire:_flag])) { - if (debugLookup) - [self debugWithFormat:@" value from superclass: %@", value]; - return value; - } - - return [self handleMissingName:_name inContext:_ctx]; -} - -/* security */ - -- (id)lookupAuthenticatorNamed:(NSString *)_name inContext:(id)_ctx { - /* look for a "user-folder" (an authentication database) */ - id auth, res; - - if ((auth = [self lookupName:_name inContext:_ctx acquire:NO])==nil) - return nil; - - if (debugAuthLookup) - [self logWithFormat:@"use '%@' user-folder: %@", _name, auth]; - if (auth == self) { - if (debugAuthLookup) - [self logWithFormat:@" auth recursion detected: %@", auth]; - return nil; - } - - res = [auth authenticatorInContext:_ctx]; - if (debugAuthLookup) - [self logWithFormat:@" got authenticator: %@", res]; - if (res == self) { - if (debugAuthLookup) { - [self logWithFormat: - @" recursion detected (%@ returned folder): %@, auth: %@", - _name, res, auth]; - } - return nil; - } - else if (res == auth) { - if (debugAuthLookup) { - [self logWithFormat: - @" recursion detected (%@ returned auth): %@", - _name, auth]; - } - return nil; - } - return res; -} - -- (id)authenticatorInContext:(id)_ctx { - /* look for a "user-folder" (an authentication database) */ - id auth; - - /* the following are flawed and can lead to recursions */ - if ((auth = [self lookupAuthenticatorNamed:@"htpasswd" inContext:_ctx])) - return auth; - if ((auth = [self lookupAuthenticatorNamed:@"acl_users" inContext:_ctx])) - return auth; - - // TODO: check children for extensions - - if (debugAuthLookup) - [self logWithFormat:@"no user-folder in folder ..."]; - - return [super authenticatorInContext:_ctx]; -} - -- (NSString *)ownerInContext:(id)_ctx { - NSString *owner; - - if ((owner = [self->props objectForKey:@"SoOwner"])) - return owner; - - /* let parent handle my owner */ - return [[self container] ownerOfChild:self inContext:_ctx]; -} - -- (NSString *)ownerOfChild:(id)_child inContext:(id)_ctx { - NSDictionary *childOwners; - NSString *owner; - - if ((childOwners = [self->props objectForKey:@"SoChildOwners"])) { - if ((owner = [childOwners objectForKey:[_ctx nameInContainer]])) - return owner; - } - - /* let child inherit owner of container */ - return [self ownerInContext:_ctx]; -} - -/* WO integration */ - -- (WOResourceManager *)resourceManagerInContext:(id)_ctx { - if (self->resourceManager == nil) { - self->resourceManager = - [[OFSResourceManager alloc] initWithBaseObject:self inContext:_ctx]; - } - return self->resourceManager; -} - -/* version control */ - -- (void)checkVersionControlSpecials { - id fm; - NSString *sp, *p; - BOOL isDir = NO; - - if ((fm = [self fileManager]) == nil) return; - if ((sp = [self storagePath]) == nil) return; - - p = [sp stringByAppendingPathComponent:@"CVS"]; - self->flags.hasCVS = [fm fileExistsAtPath:p isDirectory:&isDir] - ? (isDir ? 1 : 0) - : 0; - - p = [sp stringByAppendingPathComponent:@".svn"]; - self->flags.hasSvn = [fm fileExistsAtPath:p isDirectory:&isDir] - ? (isDir ? 1 : 0) - : 0; - - self->flags.checkedVersionSpecials = 1; -} -- (BOOL)isCvsControlled { - if (!self->flags.checkedVersionSpecials) - [self checkVersionControlSpecials]; - return self->flags.hasCVS; -} -- (BOOL)isSvnControlled { - if (!self->flags.checkedVersionSpecials) - [self checkVersionControlSpecials]; - return self->flags.hasSvn; -} - -@end /* OFSFolder */ - -@implementation OFSFolder(Factory) - -+ (id)instantiateInFactoryContext:(OFSFactoryContext *)_ctx { - /* look into plist for class */ - NSDictionary *plist; - NSData *content; - SoClass *clazz; - NSString *plistPath; - id object; - - plistPath = [[_ctx storagePath] - stringByAppendingPathComponent:@".props.plist"]; - content = [[_ctx fileManager] contentsAtPath:plistPath]; - if (content == nil) { - /* found no plist */ - clazz = [self soClass]; - } - else { - /* parse the existing plist file */ - NSString *string; - NSString *className; - - string = [[NSString alloc] initWithData:content - encoding:[NSString defaultCStringEncoding]]; - if (string == nil) { - [self logWithFormat:@"could not make string for stored data."]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"stored property list is corrupted"]; - } - - if ((plist = [string propertyList]) == nil) { - [string release]; - [self logWithFormat:@"could not make plist for stored data."]; - return [NSException exceptionWithHTTPStatus:500 - reason: - @"stored property list is corrupted " - @"(not in plist format)"]; - } - [string release]; - - /* lookup the classname in plist */ - - className = [plist objectForKey:@"SoClassName"]; - if ([className length] == 0) { - if ((className = [plist objectForKey:@"SoFolderClassName"])) - [self logWithFormat: - @"%@: SoFolderClassName is deprecated (use SoClassName) !", - plistPath]; - } - - if ([className length] == 0) { - /* no special class assigned, use default */ - clazz = [self soClass]; - } - else { - clazz = [[SoClassRegistry sharedClassRegistry] - soClassWithName:className]; - if (clazz == nil) { - [self logWithFormat:@"did not find SoClass: %@", className]; - return nil; - } - } - } - - /* instantiate */ - - if (factoryDebugOn) { - [self debugWithFormat:@"instantiate child %@ from class %@", - [_ctx nameInContainer], clazz]; - } - - object = [clazz instantiateObject]; - [object takeStorageInfoFromContext:_ctx]; - return object; -} - -@end /* OFSFolder(Factory) */ ============================================================ --- sope-appserver/SoOFS/OFSFolderClassDescription.h f0f61df76d6b26ed5d8fb65d897c8297a13fc450 +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSFolderClassDescription_H__ -#define __SoOFS_OFSFolderClassDescription_H__ - -#import - -/* - OFSFolderClassDescription - - A class description of a folder is dynamic and depends on the contents of - the folder. For example a folder exports it's contained objects as - toOneRelationshipKeys. -*/ - -@class OFSFolder; - -@interface OFSFolderClassDescription : NSClassDescription -{ - OFSFolder *object; -} - -- (id)initWithFolder:(OFSFolder *)_folder; - -@end - -#endif /* __SoOFS_OFSFolderClassDescription_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFolderClassDescription.m 2a4401389d193504b46104458aae718eab953582 +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFolderClassDescription.h" -#include "OFSFolder.h" -#include "common.h" - -@implementation OFSFolderClassDescription - -- (id)initWithFolder:(OFSFolder *)_folder { - if ((self = [super init])) { - self->object = [_folder retain]; - } - return self; -} -- (void)dealloc { - [self->object release]; - [super dealloc]; -} - -- (NSArray *)attributeKeys { - return [self->object attributeKeys]; -} - -- (NSArray *)toOneRelationshipKeys { - return [self->object toOneRelationshipKeys]; -} - -@end /* OFSFolderClassDescription */ ============================================================ --- sope-appserver/SoOFS/OFSFolderDataSource.h a78377123ba5a054a330230dcef9e4db2b5bfecf +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSFolderDataSource_H__ -#define __SoOFS_OFSFolderDataSource_H__ - -#include - -@class EOFetchSpecification; - -@interface OFSFolderDataSource : EODataSource < NSCopying > -{ - EOFetchSpecification *fetchSpecification; - id folder; -} - -+ (id)dataSourceOnFolder:(id)_folder; - -/* accessors */ - -- (void)setFetchSpecification:(EOFetchSpecification *)_fspec; -- (EOFetchSpecification *)fetchSpecification; - -@end - -#endif /* __SoOFS_OFSFolderDataSource_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSFolderDataSource.m 220d11e09f435bda56eb7b1f217ad8ec19b41185 +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSFolderDataSource.h" -#include -#include -#include "common.h" - -@interface OFSFolderFetchEnum : NSEnumerator -{ - id folder; - NSEnumerator *names; - EOQualifier *qualifier; - unsigned limit; - unsigned count; -} - -- (id)initWithFolder:(id)_folder - fetchSpecification:(EOFetchSpecification *)_fs; - -@end - -@implementation OFSFolderDataSource - -- (id)initWithFolder:(id)_folder { - if ((self = [super init])) { - self->folder = [_folder retain]; - } - return self; -} -- (id)init { - return [self initWithFolder:nil]; -} -+ (id)dataSourceOnFolder:(id)_folder { - return [[[self alloc] initWithFolder:_folder] autorelease]; -} - -- (void)dealloc { - [self->fetchSpecification release]; - [self->folder release]; - [super dealloc]; -} - -/* accessors */ - -- (id)folder { - return self->folder; -} - -- (void)setFetchSpecification:(EOFetchSpecification *)_fspec { - if ([self->fetchSpecification isEqual:_fspec]) - return; - - [self->fetchSpecification autorelease]; - self->fetchSpecification = [_fspec copy]; - - [self postDataSourceChangedNotification]; -} -- (EOFetchSpecification *)fetchSpecification { - return self->fetchSpecification; -} - -/* operations */ - -- (NSEnumerator *)fetchEnumerator { - OFSFolderFetchEnum *e; - EOFetchSpecification *fs; - NSArray *sortOrderings; - NSAutoreleasePool *pool; - NSArray *array; - unsigned limit; - EOQualifier *q; - - if ((fs = [self fetchSpecification]) == nil) { - e = [[OFSFolderFetchEnum alloc] initWithFolder:[self folder] - fetchSpecification:nil]; - return [e autorelease]; - } - - sortOrderings = [fs sortOrderings]; - if ([sortOrderings count] == 0) { - /* can do incremental fetch ... */ - e = [[OFSFolderFetchEnum alloc] initWithFolder:[self folder] - fetchSpecification:fs]; - return [e autorelease]; - } - - /* fetch => filter => limit => sort, then return enum ... */ - - pool = [[NSAutoreleasePool alloc] init]; - - array = [[self folder] allValues]; - - if ((q = [fs qualifier])) - array = [array filteredArrayUsingQualifier:q]; - - if ((limit = [fs fetchLimit]) > 0) { - /* limit ... */ - if (limit < [array count]) - array = [array subarrayWithRange:NSMakeRange(0, limit)]; - } - - array = [array sortedArrayUsingKeyOrderArray:sortOrderings]; - - e = [[array objectEnumerator] retain]; - - [pool release]; - return [e autorelease]; -} - -- (NSArray *)fetchObjects { - NSEnumerator *e; - - e = [self fetchEnumerator]; - return [[[NSArray alloc] initWithObjectsFromEnumerator:e] autorelease]; -} - -/* NSCopying */ - -- (id)copyWithZone:(NSZone *)_zone { - OFSFolderDataSource *ds; - - ds = [[[self class] alloc] initWithFolder:[self folder]]; - [ds setFetchSpecification:[self fetchSpecification]]; - return ds; -} - -@end /* OFSFolderDataSource */ - -@implementation OFSFolderFetchEnum - -- (id)initWithFolder:(id)_folder - fetchSpecification:(EOFetchSpecification *)_fs -{ - if ((self = [super init])) { - self->folder = [_folder retain]; - self->names = [[[self->folder allKeys] objectEnumerator] retain]; - self->qualifier = [[_fs qualifier] retain]; - self->limit = [_fs fetchLimit]; - } - return self; -} -- (id)init { - return [self initWithFolder:nil fetchSpecification:nil]; -} - -- (void)dealloc { - [self->qualifier release]; - [self->names release]; - [self->folder release]; - [super dealloc]; -} - -/* state */ - -- (void)clear { - [self->qualifier release]; self->qualifier = nil; - [self->names release]; self->names = nil; - [self->folder release]; self->folder = nil; -} - -/* enumerator */ - -- (id)_nextObjectToBeFiltered { - NSString *nextName; - id object; - - if ((nextName = [self->names nextObject]) == nil) { - [self clear]; - return nil; - } - if ((object = [(NSDictionary *)self->folder objectForKey:nextName]) == nil) { - [self clear]; - return nil; - } - return object; -} - -- (id)nextObject { - id obj; - - if(self->qualifier != nil) { - do { - if ((obj = [self _nextObjectToBeFiltered]) == nil) { - [self clear]; - return nil; - } - } - while (![(id)self->qualifier - evaluateWithObject:obj]); - } - else { - if ((obj = [self _nextObjectToBeFiltered]) == nil) { - [self clear]; - return nil; - } - } - - self->count++; - if (self->limit > 0 && self->count > self->limit) { - [self clear]; - return nil; - } - - return obj; -} - -@end /* OFSFolderFetchEnum */ ============================================================ --- sope-appserver/SoOFS/OFSHttpPasswd.h 81aaf62abf812b02a2fd2ee7e72d06312cad066c +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSHttpPasswd_H__ -#define __SoOFS_OFSHttpPasswd_H__ - -#include - -/* - OFSHttpPasswd - - A user-folder which uses an Apache htpasswd file as a authentication - database (only crypt is currently supported !) -*/ - -@class NSString, NSArray, NSDictionary; - -@interface OFSHttpPasswd : OFSFile -{ - id authenticator; /* cache */ - NSDictionary *content; -} - -/* implementation */ -- (NSString *)authRealm; -- (NSArray *)rolesForLogin:(NSString *)_login; -- (BOOL)checkLogin:(NSString *)_login password:(NSString *)_pwd; - -@end - -#endif /* __SoOFS_OFSHttpPasswd_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSHttpPasswd.m 7f07262f3f03d5afe7569e802819b14e1d20d080 +++ /dev/null @@ -1,221 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSHttpPasswd.h" -#include -#include "common.h" - -#if defined (__APPLE__) || defined(__FreeBSD__) -# include -#else -# if defined(__OpenBSD__) -# include -# else -# include -# endif -#endif - -/* - Note: a user-folder is different to an authenticator (though a user - folder can be a authenticator itself) ! A user-folder manages the whole - user-database while an authenticator decodes HTTP authentication info, - checks a password against a user and retrieves only authentication related - information on a user. - - So: a user-folder is strongly related to an authenticator, but isn't - usually the actual authenticator object (which usually inherits from - SoHTTPAuthenticator). -*/ - -// TODO: implement ... - -@interface OFSHttpPasswdAuthenticator : SoHTTPAuthenticator -{ - OFSHttpPasswd *passwd; /* non-retained */ -} - -- (id)initWithObject:(id)_obj; -- (void)detach; - -@end - -@implementation OFSHttpPasswd - -static BOOL debugOn = NO; -static NSArray *plainRoles = nil; -static NSArray *rootRoles = nil; - -+ (void)initialize { - if (plainRoles == nil) { - plainRoles = [[NSArray alloc] initWithObjects: - SoRole_Authenticated, SoRole_Anonymous, nil]; - } - if (rootRoles == nil) { - rootRoles = [[NSArray alloc] initWithObjects: - SoRole_Manager, SoRole_Authenticated, - SoRole_Anonymous, nil]; - } -} - -- (void)dealloc { - [self->content release]; - [self->authenticator detach]; - [self->authenticator release]; - [super dealloc]; -} - -- (id)authenticatorInContext:(id)_ctx { - if (self->authenticator == nil) { - self->authenticator = - [[OFSHttpPasswdAuthenticator alloc] initWithObject:self]; - } - return self->authenticator; -} - -/* loading htpasswd */ - -- (NSException *)primaryLoad { - NSMutableDictionary *md; - NSString *s; - NSArray *lines; - unsigned i, count; - - [self->content release]; self->content = nil; - - s = [self contentAsString]; - lines = [s componentsSeparatedByString:@"\n"]; - count = [lines count]; - md = [NSMutableDictionary dictionaryWithCapacity:(count + 1)]; - - for (i = 0; i < count; i++) { - NSString *s; - NSRange r; - NSString *login, *pwd; - - s = [lines objectAtIndex:i]; - r = [s rangeOfString:@":"]; - if (r.length == 0) continue; - - login = [s substringToIndex:r.location]; - pwd = [s substringFromIndex:(r.location + r.length)]; - - [md setObject:pwd forKey:login]; - } - self->content = [md copy]; - return nil; -} - -- (NSString *)cryptedPasswordForLogin:(NSString *)_login { - NSException *error; - - if ([_login length] < 1) - return nil; - if (self->content) - return [self->content objectForKey:_login]; - - if ((error = [self primaryLoad])) - return nil; - - return [self->content objectForKey:_login]; -} - -/* authenticator implementation */ - -- (BOOL)checkLogin:(NSString *)_login password:(NSString *)_pwd { - NSString *cryptedPwd; - NSString *cpo; - const char *cp; - - if (debugOn) - [self debugWithFormat:@"check '%@' against pwd ...", _login]; - - if ((cryptedPwd = [self cryptedPasswordForLogin:_login]) == nil) { - [self debugWithFormat:@" user '%@' not available in htpasswd", _login]; - return NO; - } - - if (debugOn) - [self debugWithFormat:@" check crypted pwd of user '%@' ...", _login]; - - // salt is user-pwd itself (crypt(pwd, cryptedpwd)) - cp = crypt([_pwd cString], [cryptedPwd cString]); - cpo = cp ? [NSString stringWithCString:cp] : nil; - - return [cryptedPwd isEqualToString:cpo]; -} - -- (NSString *)authRealm { - return [(WOApplication *)[WOApplication application] name]; -} - -- (BOOL)isRootLogin:(NSString *)_login { - return [_login isEqualToString:@"root"]; -} -- (NSArray *)rolesForLogin:(NSString *)_login { - return [self isRootLogin:_login] ? rootRoles : plainRoles; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { - return debugOn; -} - -@end /* OFSHttpPasswd */ - -@implementation OFSHttpPasswdAuthenticator - -- (id)initWithObject:(id)_obj { - NSAssert(_obj, @"missing htpasswd user folder in argument ..."); - if ((self = [super init])) { - self->passwd = _obj; - } - return self; -} -- (id)init { - return [self initWithObject:nil]; -} - -- (void)detach { - self->passwd = nil; -} - -/* implement using folder itself ... */ - -- (BOOL)checkLogin:(NSString *)_login password:(NSString *)_pwd { - return [self->passwd checkLogin:_login password:_pwd]; -} - -- (NSString *)authRealm { - return [self->passwd authRealm]; -} - -- (NSArray *)rolesForLogin:(NSString *)_login { - return [self->passwd rolesForLogin:_login]; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { - return debugOn; -} - -@end /* OFSHttpPasswdAuthenticator */ ============================================================ --- sope-appserver/SoOFS/OFSImage.h 7b2f182efe6d0bc7f1f5207cca73a5773a7fa8d5 +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSImage_H__ -#define __OFS_OFSImage_H__ - -#include - -/* - OFSImage - - OFSImage is just like OFSFile. It will also be able to calculate image - dimension and has different management panels. -*/ - -@interface OFSImage : OFSFile -{ -} - -@end - -#endif /* __OFS_OFSImage_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSImage.m b8a39b001ad26baf2271e5fa160d250d238b0f77 +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSImage.h" -#include "common.h" - -@implementation OFSImage - -+ (int)version { - return [super version] + 0 /* v1 */; -} -+ (void)initialize { - static BOOL didInit = NO; - if (!didInit) { - didInit = YES; - NSAssert2([super version] == 1, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - } -} - -- (void)dealloc { - [super dealloc]; -} - -/* operations */ - -- (NSString *)contentTypeInContext:(WOContext *)_ctx { - NSString *ext; - - ext = [[self storagePath] pathExtension]; - if ([ext isEqualToString:@"gif"]) return @"image/gif"; - if ([ext isEqualToString:@"jpg"]) return @"image/jpeg"; - if ([ext isEqualToString:@"png"]) return @"image/png"; - if ([ext isEqualToString:@"jpeg"]) return @"image/jpeg"; - return @"image/octet-stream"; -} - -@end /* OFSImage */ ============================================================ --- sope-appserver/SoOFS/OFSPropertyListObject.h 119a8c4c46ee482483572035ef667ac5c7692e36 +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSPropertyListObject_H__ -#define __OFS_OFSPropertyListObject_H__ - -#include - -/* - OFSPropertyListObject - - The OFSPropertyListObject represents objects archived in a property list, - that is, it's a quick way to store objects structured in a simple way. - - Note that the property list is loaded on-demand (if a stored key is - accessed). - - The class OFSPropertyListObject also acts as an object factory. -*/ - -@class NSArray, NSMutableDictionary; - -@interface OFSPropertyListObject : OFSFile -{ - NSMutableDictionary *record; /* loaded on-demand */ - NSArray *recordKeys; - struct { - BOOL isLoading:1; - BOOL isLoaded:1; - BOOL isEdited:1; - BOOL isNew:1; - int reserved:28; - } flags; -} - -/* accessors */ - -- (NSArray *)allKeys; - -/* storage */ - -- (void)willChange; -- (BOOL)isRestored; -- (NSException *)restoreObject; -- (NSException *)saveObject; - -@end - -#endif /* __OFS_OFSPropertyListObject_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSPropertyListObject.m 7608026668004de394350956d4ee76b0ad74f96b +++ /dev/null @@ -1,496 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSPropertyListObject.h" -#include "OFSFactoryContext.h" -#include -#include "common.h" - -@interface OFSPropertyListObjectClassDescription : NSClassDescription -{ -@public - OFSPropertyListObject *object; -} - -@end - -@implementation OFSPropertyListObject - -static int debugOn = 0; - -+ (int)version { - return [super version] + 0 /* v1 */; -} -+ (void)initialize { - static BOOL didInit = NO; - if (!didInit) { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - didInit = YES; - NSAssert2([super version] == 1, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - - debugOn = [ud boolForKey:@"SoOFSDebugPlistObject"] ? 1 : 0; - } -} - -- (void)dealloc { - [self->recordKeys release]; - [self->record release]; - [super dealloc]; -} - -/* storage */ - -- (NSStringEncoding)stringEncoding { - return [NSString defaultCStringEncoding]; -} - -- (void)setSoResourceClassName:(NSString *)_name {} // ignore -- (void)setSoClassName:(NSString *)_name {} // ignore -- (NSString *)soResourceClassName { // deprecated - return [[self soClass] className]; -} -- (NSString *)soClassName { - return [[self soClass] className]; -} - -- (NSArray *)attributeKeys { - [[self restoreObject] raise]; - return self->recordKeys; -} - -- (NSArray *)allKeys { - return [self attributeKeys]; -} - -- (NSClassDescription *)soClassDescription { - OFSPropertyListObjectClassDescription *cd; - cd = [[OFSPropertyListObjectClassDescription alloc] init]; - cd->object = [self retain]; - return [cd autorelease]; -} - -- (NSString *)contentAsString { - /* do not allow access to raw contents ! */ - return nil; -} - -- (void)removeSpecialKeysFromRestoreDictionary:(NSMutableDictionary *)_md { - /* remove special storage keys like SoClassName to plist */ - [_md removeObjectForKey:@"SoClassName"]; - [_md removeObjectForKey:@"SoResourceClassName"]; -} -- (void)addSpecialKeysToSaveDictionary:(NSMutableDictionary *)_md { - /* add special storage keys like SoClassName to plist */ - [_md setObject:[self soClassName] forKey:@"SoClassName"]; -} - -- (NSException *)restoreObject { - NSMutableDictionary *plist = nil; - NSException *e; - NSData *content; - NSString *s; - id fm; - - if (self->flags.isLoaded) return nil; - if ((fm = [self fileManager]) == nil) { - e = [NSException exceptionWithHTTPStatus:500 - reason:@"plist object has no filemanager ??"]; - return e; - } - s = [self storagePath]; - if ([s length] == 0) { - e = [NSException exceptionWithHTTPStatus:500 - reason:@"plist object has no storage path ??"]; - return e; - } - - self->flags.isLoading = 1; - self->flags.isLoaded = 1; - e = nil; - - /* load file, convert into string, then into a property list */ - - if ((content = [fm contentsAtPath:s])==nil) { - if (([fm respondsToSelector:@selector(lastException)])) { - e = [fm lastException]; - goto done; - } - else { - e = [NSException exceptionWithHTTPStatus:404 /* not found */ - reason:@"failed to load property list file ..."]; - goto done; - } - } - s = [[NSString alloc] initWithData:content encoding:[self stringEncoding]]; - if (s == nil) { - e = [NSException exceptionWithHTTPStatus:500 - reason:@"failed to create string from file ..."]; - goto done; - } - plist = [[s propertyList] mutableCopy]; - [s release]; - if (plist == nil) { - e = [NSException exceptionWithHTTPStatus:500 - reason:@"failed to create property list from file ..."]; - goto done; - } - - [self removeSpecialKeysFromRestoreDictionary:plist]; - - self->recordKeys = [[plist allKeys] copy]; - if (debugOn) - [self debugWithFormat:@"taking values of: %@", plist]; - [self takeValuesFromDictionary:plist]; - [plist release]; - - done: - self->flags.isEdited = 0; - self->flags.isLoading = 0; - return e; -} - -- (void)willChange { - if (!self->flags.isLoading) - self->flags.isEdited = 1; -} -- (BOOL)isRestored { - return self->flags.isLoaded ? YES : NO; -} - -- (NSException *)saveObject { - NSMutableDictionary *d; - NSException *e; - NSString *s; - NSData *content; - id fm; - - e = (self->flags.isNew) - ? [self validateForInsert] - : [self validateForSave]; - if (e) return e; - - if (!self->flags.isNew) { - if ((e = [self restoreObject])) - return e; - } - - d = (self->recordKeys) - ? [[self valuesForKeys:self->recordKeys] mutableCopy] - : [self->record mutableCopy]; - - if (d == nil) { - [self logWithFormat:@"got no dict to save ..."]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"got no record to save ..."]; - } - - [self addSpecialKeysToSaveDictionary:d]; - - s = [d description]; - [d release]; - - content = [s dataUsingEncoding:[self stringEncoding]]; - - fm = [self fileManager]; - - if (![fm writeContents:content atPath:[self storagePath]]) { - [self logWithFormat:@"failed to update file: %@", [self storagePath]]; - - if (([fm respondsToSelector:@selector(lastException)])) - return [fm lastException]; - else { - return [NSException exceptionWithHTTPStatus:500 - reason:@"failed to update property list file ..."]; - } - } - - self->flags.isNew = 0; - return nil; -} - -/* KVC */ - -- (void)handleTakeValue:(id)_value forUnboundKey:(NSString *)_key { - id oldValue; - - if ((oldValue = [self->record objectForKey:_key]) == nil) { - if (_value == nil) return; - } - else if (![_value isNotNull]) { - [self willChange]; - [self->record removeObjectForKey:_key]; - return; - } - else if (oldValue == _value) { - return; - } - else if ([oldValue isEqual:_value]) - return; - - [self willChange]; - - if (self->record == nil) - self->record = [[NSMutableDictionary alloc] initWithCapacity:16]; - - if (!self->flags.isLoading && debugOn) - [self debugWithFormat:@"set unbound key: %@", _key]; - - if (![self->recordKeys containsObject:_key]) { - NSMutableArray *rk; - - rk = [self->recordKeys mutableCopy]; - [rk addObject:_key]; - [self->recordKeys release]; - self->recordKeys = rk; - } - - [self->record setObject:(_value ? _value: (id)@"") forKey:_key]; -} - -- (BOOL)isStoredKey:(NSString *)_key { - /* says whether we need to restore the object to access the key */ - if ([_key hasPrefix:@"NS"]) { - if ([_key isEqualToString:@"NSFileSubject"]) - return YES; - return NO; - } - return YES; -} - -- (void)takeValue:(id)_value forKey:(NSString *)_name { - if (!self->flags.isLoaded && !self->flags.isLoading) { - if ([self isStoredKey:_name]) - [[self restoreObject] raise]; - } - - [super takeValue:_value forKey:_name]; -} - -- (id)valueForKey:(NSString *)_name { - id v = nil; - - if ([_name hasPrefix:@"NS"]) { - if ([_name isEqualToString:@"NSFileSize"]) - v = [self davContentLength]; - else if ([_name isEqualToString:@"NSFileSubject"]) - v = [self davDisplayName]; - else - /* this implies that stored keys never begin with NS ! (good ?) */ - v = [super valueForKey:_name]; - } - else if ([self isStoredKey:_name]) { - if ((v = [self restoreObject])) - /* v is the restoration exception, do not want to raise */; - else if ((v = [self->record objectForKey:_name])) - /* a record value */; - else - /* stored-key doesn't say *where* it is stored ! */ - v = [super valueForKey:_name]; - } - else - v = [super valueForKey:_name]; - - return v; -} - -/* operations */ - -- (id)GETAction:(WOContext *)_ctx { - NSException *e; - - if ((e = [self restoreObject])) - return e; - - /* let the renderer deal with our representation ... */ - return self; -} - -- (id)PUTAction:(WOContext *)_ctx { - return [NSException exceptionWithHTTPStatus:405 /* method not allowed */ - reason:@"HTTP PUT not yet allowed on plist objects"]; -} - -/* WebDAV support */ - -- (NSString *)davDisplayName { - return [[self nameInContainer] stringByDeletingPathExtension]; -} -- (id)davContentLength { - static NSNumber *zero = nil; - if (zero == nil) zero = [[NSNumber numberWithInt:0] retain]; - return zero; -} - -- (NSException *)davSetProperties:(NSDictionary *)_setProps - removePropertiesNamed:(NSArray *)_delProps - inContext:(id)_ctx -{ - NSException *e; - - if (debugOn) - [self debugWithFormat:@"patch: %@, del: %@", _setProps, _delProps]; - - if ((e = [self restoreObject])) - return e; - - if ([_setProps count] > 0) - [self takeValuesFromDictionary:_setProps]; - - if ([_delProps count] > 0) { - NSMutableArray *rk; - - [self->record removeObjectsForKeys:_delProps]; - rk = [self->recordKeys mutableCopy]; - [rk removeObjectsInArray:_delProps]; - [self->recordKeys release]; - self->recordKeys = rk; - } - - if ((e = [self saveObject])) { - [self logWithFormat:@"update failed ..."]; - return e; - } - - return nil; -} - -/* factory */ - -+ (id)instantiateInFactoryContext:(OFSFactoryContext *)_ctx { - /* look into plist for class */ - NSException *e; - OFSPropertyListObject *object; - SoClass *clazz; - - if ([_ctx isNewObject]) { - /* create a new object in the storage */ - clazz = [self soClass]; - - /* instantiate */ - if (debugOn) { - [self debugWithFormat:@"instantiate child %@ from class %@", - [_ctx nameInContainer], clazz]; - } - - object = [clazz instantiateObject]; - [object takeStorageInfoFromContext:_ctx]; - - if ([object isKindOfClass:[OFSPropertyListObject class]]) - object->flags.isNew = 1; - - if ((e = [object saveObject])) { - [self debugWithFormat:@" save failed: %@", e]; - return e; - } - } - else { - /* restore object from storage */ - NSDictionary *plist; - NSData *content; - NSString *string; - NSString *className; - - content = [[_ctx fileManager] contentsAtPath:[_ctx storagePath]]; - if (content == nil) - /* hm, file doesn't exist ? */ - return [super instantiateInFactoryContext:_ctx]; - - /* parse the existing plist file */ - - string = [[NSString alloc] initWithData:content - encoding:[NSString defaultCStringEncoding]]; - if (string == nil) { - [self logWithFormat:@"could not make string for stored data."]; - return [NSException exceptionWithHTTPStatus:500 - reason:@"stored property list is corrupted"]; - } - - if ((plist = [string propertyList]) == nil) { - [string release]; - [self logWithFormat:@"could not make plist for stored data."]; - return [NSException exceptionWithHTTPStatus:500 - reason: - @"stored property list is corrupted " - @"(not in plist format)"]; - } - [string release]; - - /* lookup the classname in plist */ - - className = [plist objectForKey:@"SoClassName"]; - if ([className length] == 0) - /* no special class assigned, use default */ - clazz = [self soClass]; - else { - clazz = [[SoClassRegistry sharedClassRegistry] soClassWithName:className]; - if (clazz == nil) { - [self logWithFormat:@"did not find SoClass: %@", className]; - return nil; - } - } - - /* instantiate */ - - if (debugOn) { - [self debugWithFormat:@"instantiate child %@ from class %@", - [_ctx nameInContainer], clazz]; - } - - object = [clazz instantiateObject]; - [object takeStorageInfoFromContext:_ctx]; - - /* restore */ - - if (debugOn) { - [self debugWithFormat:@"restore child %@: %@", - [_ctx nameInContainer], object]; - } - - if ((e = [object restoreObject])) { - [self debugWithFormat:@" restore failed: %@", e]; - return e; - } - } - return object; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { - return debugOn ? YES : NO; -} - -@end /* OFSPropertyListObject */ - -@implementation OFSPropertyListObjectClassDescription - -- (void)dealloc { - [self->object release]; - [super dealloc]; -} - -- (NSArray *)attributeKeys { - return [self->object attributeKeys]; -} - -@end /* OFSPropertyListObjectClassDescription */ ============================================================ --- sope-appserver/SoOFS/OFSResourceManager.h e02467209c48d4f18c155dd5873b2bcccaaedb31 +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSResourceManager_H__ -#define __SoOFS_OFSResourceManager_H__ - -#include - -/* - OFSResourceManager - - OFSResourceManager is an NGObjWeb resource manager which locates resources - by traversing the OFS hierarchy. -*/ - -@interface OFSResourceManager : WOResourceManager -{ - id baseObject; /* non-retained ! */ - id context; /* non-retained ! */ -} - -- (id)initWithBaseObject:(id)_object inContext:(id)_ctx; - -/* lookup */ - -- (NSString *)pathForResourceNamed:(NSString *)_name - inFramework:(NSString *)_frameworkName - languages:(NSArray *)_languages; - -- (NSString *)urlForResourceNamed:(NSString *)_name - inFramework:(NSString *)_frameworkName - languages:(NSArray *)_languages - request:(WORequest *)_request; - -/* operations */ - -- (void)invalidate; - -@end - -#endif /* __SoOFS_OFSResourceManager_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSResourceManager.m 5bf1e0b26bb75b0bdccc2829473990b3382d0e27 +++ /dev/null @@ -1,245 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSResourceManager.h" -#include "OFSBaseObject.h" -#include -#include "common.h" - -@interface WOResourceManager(UsedPrivates) -- (WOComponentDefinition *)definitionForComponent:(id)_name - inFramework:(NSString *)_framework - languages:(NSArray *)_languages; -@end - -@interface WOComponentDefinition(UsedPrivates) -- (void)setComponentClass:(Class)_clazz; -@end - -@interface WOComponent(RM) -- (void)setResourceManager:(WOResourceManager *)_rm; -@end - -@implementation OFSResourceManager - -static BOOL debugOn = NO; - -+ (void)initialize { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - - debugOn = [ud boolForKey:@"SoOFSResourceManagerDebugEnabled"]; -} - -- (id)initWithBaseObject:(id)_object inContext:(id)_ctx { - if ((self = [super init])) { - self->baseObject = _object; - self->context = _ctx; - - if (self->baseObject == nil) { - [self release]; - return nil; - } - - if (self->context == nil) - [self debugWithFormat:@"WARNING: got not context !"]; - } - return self; -} - -- (void)dealloc { - [super dealloc]; -} - -- (void)invalidate { - self->baseObject = nil; - self->context = nil; -} - -/* accessors */ - -- (id)context { - if (self->context == nil) - return [(WOApplication *)[WOApplication application] context]; - return self->context; -} - -/* base object lookup */ - -- (BOOL)doesAcquireResources { - return YES; -} - -- (id)soObjectForResourceNamed:(NSString *)_name - inFramework:(NSString *)_frameworkName - languages:(NSArray *)_languages -{ - id resourceObject; - - if (debugOn) { - [self debugWithFormat:@"lookup resource object named '%@' in %@", - _name, self->baseObject]; - } - - if ([self doesAcquireResources]) { - NSException *error = nil; - id subctx; - - /* - Note: this will first look into the object traversal stack of the - context which might be different to the base object! - e.g. its common to use the resource manager on the container - of the clientObject (baseObject==container) instead of the - object itself. - */ - subctx = [[self context] createSubContext]; - resourceObject = [self->baseObject - traverseKey:_name - inContext:subctx - error:&error - acquire:YES]; - if (error) { - if (debugOn) { - [self debugWithFormat:@" name: %@", _name]; - [self debugWithFormat:@" base: %@", self->baseObject]; - [self debugWithFormat:@" ctx: %@", subctx]; - } - [self logWithFormat:@"ERROR: %@", error]; - } - } - else { - resourceObject = [self->baseObject lookupName:_name - inContext:[self context] - acquire:YES]; - } - - if (debugOn) - [self debugWithFormat:@" found: %@", resourceObject]; - return resourceObject; -} - -/* components */ - -- (WOComponentDefinition *)definitionForComponent:(id)_name - inFramework:(NSString *)_framework - languages:(NSArray *)_languages -{ - WOComponentDefinition *cdef; - NSRange r; - NSString *name; - Class cClass; - - cdef = [super definitionForComponent:_name - inFramework:_framework - languages:_languages]; - r = [_name rangeOfString:@"."]; - if (r.length > 0) - name = [_name substringToIndex:r.location]; - else - name = _name; - - cClass = NSClassFromString(name); - if (cClass == Nil) - cClass = NSClassFromString(@"WOComponent"); - - [cdef setComponentClass:cClass]; - return cdef; -} - -/* resource manager methods */ - -- (NSString *)forcedComponentExtension { - /* the content negotiation should select an extension for us ! */ - return nil; -} - -- (NSString *)resourceNameForComponentNamed:(NSString *)_name { - NSString *ext; - - if ((ext = [self forcedComponentExtension])) { - if ([[_name pathExtension] length] == 0) - _name = [_name stringByAppendingPathExtension:ext]; - } - return _name; -} - -- (NSString *)pathForResourceNamed:(NSString *)_name - inFramework:(NSString *)_fw - languages:(NSArray *)_langs -{ - // TODO: add a cache - id obj; - - obj = [self soObjectForResourceNamed:_name inFramework:_fw languages:_langs]; - if (obj == nil) - [self debugWithFormat:@"found no resource object named '%@'", _name]; - else - [self debugWithFormat:@"found resource object '%@': %@", _name, obj]; - - return [obj storagePath]; -} - -- (NSString *)urlForResourceNamed:(NSString *)_name - inFramework:(NSString *)_fw - languages:(NSArray *)_langs - request:(WORequest *)_request -{ - // TODO: add a cache - id obj; - - obj = [self soObjectForResourceNamed:_name inFramework:_fw languages:_langs]; - if (obj == nil) - [self logWithFormat:@"found no object named '%@'", _name]; - - return [obj baseURLInContext:[self context]]; -} - -- (id)pageWithName:(NSString *)_name languages:(NSArray *)_langs { - WOComponent *p; - - p = [super pageWithName:_name languages:_langs]; - [p setResourceManager:self]; - return p; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { - return debugOn; -} - -/* description */ - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:64]; - [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])]; - - if (self->baseObject) - [ms appendFormat:@" base=%@", self->baseObject]; - if (self->context) - [ms appendFormat:@" ctx=0x%p", self->context]; - - [ms appendString:@">"]; - return ms; -} - -@end /* OFSResourceManager */ ============================================================ --- sope-appserver/SoOFS/OFSWebDocument.h 546cc0030303d16a5b1e02316dd382df03560297 +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSWebDocument_H__ -#define __SoOFS_OFSWebDocument_H__ - -#include - -/* - OFSWebDocument - - A web-document is basically the same thing like a web method - the only - difference is the assignment of the "clientObject" in the context. A method - always applies on the object prior in it's traversal path while a document - applies to itself. -*/ - -@interface OFSWebDocument : OFSWebMethod -{ -} - -@end - -#endif /* __SoOFS_OFSWebDocument_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSWebDocument.m e3e066a2dc2ace649cfa5cf9e9b0b276482f6d8d +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSWebDocument.h" -#include "common.h" - -@implementation OFSWebDocument - -- (void)dealloc { - [super dealloc]; -} - -/* calling (being a document ...) */ - -- (BOOL)isCallable { - return NO; -} - -- (id)callOnObject:(id)_client inContext:(id)_ctx { - if (_client == nil || _client == self) - return self; - - [self logWithFormat:@"attempt to use OFSWebDocument as a method ?"]; - return [self viewAction:_ctx]; -} - -- (id)clientObject { - return self; -} - -@end /* OFSWebDocument */ ============================================================ --- sope-appserver/SoOFS/OFSWebMethod.h 2dfc6b3d57251b482417c8e10ff44c746f7db8fe +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __OFS_OFSWebMethod_H__ -#define __OFS_OFSWebMethod_H__ - -#include - -/* - OFSWebMethod - - OFSWebMethod is for storing and activating NGObjWeb based components - from OFS. -*/ - -@class NSException; -@class WOComponent, WOResourceManager, WOContext; - -@interface OFSWebMethod : OFSFile -{ - WOComponent *component; -} - -/* page */ - -- (WOComponent *)component; - -/* actions */ - -- (id)GETAction:(WOContext *)_ctx; -- (id)viewAction:(WOContext *)_ctx; - -@end - -@interface NSObject(OFSWebMethodClassify) -- (BOOL)isOFSWebMethod; -@end - -#endif /* __OFS_OFSWebMethod_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSWebMethod.m ce4a75265ccdc3c25f5761dce2b80ae29041608b +++ /dev/null @@ -1,207 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSWebMethod.h" -#include -#include -#include -#include -#include "common.h" - -@interface WOComponent(RM) -- (void)setResourceManager:(WOResourceManager *)_rm; -@end - -@implementation OFSWebMethod - -static BOOL debugOn = NO; - -+ (int)version { - return [super version] + 0 /* v1 */; -} -+ (void)initialize { - static BOOL didInit = NO; - if (!didInit) { - didInit = YES; - NSAssert2([super version] == 1, - @"invalid superclass (%@) version %i !", - NSStringFromClass([self superclass]), [super version]); - - debugOn = [[NSUserDefaults standardUserDefaults] - boolForKey:@"SoOFSWebMethodDebugEnabled"]; - } -} - -- (void)dealloc { - [self->component release]; - [super dealloc]; -} - -/* page */ - -- (WOResourceManager *)resourceManagerInContext:(id)_ctx { - return [[self container] resourceManagerInContext:_ctx]; -} - -- (WOComponent *)componentInContext:(WOContext *)_ctx { - WOResourceManager *rm; - WOComponent *lPage; - NSArray *languages; - - if (self->component) - return self->component; - - [self debugWithFormat:@"should load component: %@", [self storagePath]]; - if ((rm = [self resourceManagerInContext:_ctx]) == nil) { - [self logWithFormat:@"got no resource manager ..."]; - return nil; - } - - /* determine language */ - - languages = [_ctx hasSession] - ? [(WOSession *)[_ctx session] languages] - : [[_ctx request] browserLanguages]; - - /* instantiate */ - - lPage = [rm pageWithName:[self nameInContainer] languages:languages]; - [lPage ensureAwakeInContext:_ctx]; - [lPage setResourceManager:rm]; - - [self debugWithFormat:@" page: %@", lPage]; - - self->component = [lPage retain]; - return self->component; -} -- (WOComponent *)component { - return [self componentInContext:[[WOApplication application] context]]; -} - -/* actions */ - -- (id)rendererForObject:(id)_object inContext:(WOContext *)_ctx { - // TODO: should return the component ? - // TODO: add OFSWebMethodRenderer which selects on DAV ? - return nil; -} - -- (id)getUnparsedContentInContext:(WOContext *)_ctx { - /* this method should not be publically available ! */ - // TODO: check permission for source-view ! - return [super GETAction:_ctx]; -} - -- (BOOL)useRendererForComponentCreation { - /* will GET/view return the component as a result or self ? */ - return NO; -} - -- (id)viewAction:(WOContext *)_ctx { - /* - The difference to get is, that view always renders the content, so - you can get a rendered representation even with a WebDAV client. - */ - - /* the default renderer will recognize that as a component ... */ - return [self useRendererForComponentCreation] - ? (id)self - : (id)[self componentInContext:_ctx]; -} - -- (id)GETAction:(WOContext *)_ctx { - WORequest *rq; - NSString *translate; - - rq = [_ctx request]; - translate = [[rq headerForKey:@"translate"] lowercaseString]; - - if ([translate hasPrefix:@"f"]) { - /* return the unparsed body */ - if (debugOn) - [self debugWithFormat:@"returning unparsed content (translate f)"]; - return [self getUnparsedContentInContext:_ctx]; - } - - if ([[rq clientCapabilities] isDAVClient]) { - /* return the unparsed body */ - if (debugOn) - [self debugWithFormat:@"returning unparsed content (DAV-client)"]; - return [self getUnparsedContentInContext:_ctx]; - } - - /* the default renderer will recognize that as a component ... */ - if (debugOn) [self debugWithFormat:@"return component object for GET ..."]; - return [self viewAction:_ctx]; -} -- (id)POSTAction:(WOContext *)_ctx { - WOComponent *comp; - - if (debugOn) [self debugWithFormat:@"process POST using component ..."]; - - if ((comp = [self componentInContext:_ctx]) == nil) - return nil; - - // TODO: should we invoke some action ? - // TODO: maybe the renderer should do the takeValues/invoke/... ?? - [comp takeValuesFromRequest:[_ctx request] inContext:_ctx]; - return comp; -} - -- (BOOL)isOFSWebMethod { - return YES; -} - -/* calling (being a method ...) */ - -- (BOOL)isCallable { - return YES; -} - -- (id)callOnObject:(id)_client inContext:(id)_ctx { - WOComponent *c; - - if ((c = [self componentInContext:_ctx]) == nil) - return nil; - - [c setClientObject:_client]; - return c; -} - -- (id)clientObject { - return [[[WOApplication application] context] clientObject]; -} - -/* debugging */ - -- (BOOL)isDebuggingEnabled { - return debugOn; -} - -@end /* OFSWebMethod */ - -@implementation NSObject(OFSWebMethodClassify) - -- (BOOL)isOFSWebMethod { - return NO; -} - -@end /* NSObject(OFSWebMethodClassify) */ ============================================================ --- sope-appserver/SoOFS/OFSWebMethodRenderer.h 1f38ea39d53c1ea0e28902c7a2879a372c53bca1 +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSWebMethodRenderer_H__ -#define __SoOFS_OFSWebMethodRenderer_H__ - -#import - -/* - OFSWebMethodRenderer - - Renders OFSWebMethod objects by getting it's WOComponent and render that. -*/ - -@class NSException; -@class WOContext; - -@interface OFSWebMethodRenderer : NSObject -{ -} - -+ (id)sharedRenderer; - -- (NSException *)renderObject:(id)_object inContext:(WOContext *)_ctx; -- (BOOL)canRenderObject:(id)_object inContext:(WOContext *)_ctx; - -@end - -#endif /* __SoOFS_OFSWebMethodRenderer_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSWebMethodRenderer.m f17dbc78b4c752d43e550f63386fb45c0d85a9ed +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSWebMethodRenderer.h" -#include "OFSWebMethod.h" -#include -#include "common.h" - -@interface OFSWebMethod(Privates) -- (WOComponent *)componentInContext:(WOContext *)_ctx; -@end - -@implementation OFSWebMethodRenderer - -+ (id)sharedRenderer { - static OFSWebMethodRenderer *singleton = nil; - if (singleton == nil) - singleton = [[OFSWebMethodRenderer alloc] init]; - return singleton; -} - -/* rendering */ - -- (NSException *)renderComponent:(WOComponent *)_c inContext:(WOContext *)_ctx{ - WOResponse *r = [_ctx response]; - - [r setHeader:@"text/html" forKey:@"content-type"]; - [_ctx setPage:_c]; - [_ctx enterComponent:_c content:nil]; - [_c appendToResponse:r inContext:_ctx]; - [_ctx leaveComponent:_c]; - return nil; -} - -- (NSException *)renderObject:(id)_object inContext:(WOContext *)_ctx { - WOComponent *component; - - if (![_object isOFSWebMethod]) - return [NSException exceptionWithHTTPStatus:500 /* server error */]; - - if ((component = [_object componentInContext:_ctx]) == nil) - return [NSException exceptionWithHTTPStatus:500 /* server error */]; - - return [self renderComponent:component inContext:_ctx]; -} - -- (BOOL)canRenderObject:(id)_object inContext:(WOContext *)_ctx { - return [_object isOFSWebMethod]; -} - -/* debugging */ - -- (NSString *)loggingPrefix { - return @"[so-component-renderer]"; -} - -@end /* OFSWebMethodRenderer */ ============================================================ --- sope-appserver/SoOFS/OFSWebTemplate.h 203b1dc9e8b9d7a4005006f3de4cce0005faa589 +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_OFSWebTemplate_H__ -#define __SoOFS_OFSWebTemplate_H__ - -#include - -/* - OFSWebTemplate - - A specialized SoClass for handling SOPE templates. The major difference - is, that templates cannot be access through the web ! - - [TODO: implement the web-limit, templates should not be callable !] -*/ - -@interface OFSWebTemplate : OFSWebMethod -{ -} - -@end - -#endif /* __SoOFS_OFSWebTemplate_H__ */ ============================================================ --- sope-appserver/SoOFS/OFSWebTemplate.m b0f2d640d08488a042bdc56e8afa3b8b240161b8 +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "OFSWebTemplate.h" -#include "common.h" - -@implementation OFSWebTemplate - -- (void)dealloc { - [super dealloc]; -} - -@end /* OFSWebTemplate */ ============================================================ --- sope-appserver/SoOFS/README e15b6e67271c03749e23575ce464287856e94927 +++ /dev/null @@ -1,25 +0,0 @@ -The SOPE Object File System (OFS) -================================= - -First note that SOPE OFS is different from Zope OFS. Zope OFS is basically a -filesystem view on the ZODB Python object database while SOPE OFS is SoObject -support for filesystem based entities (so basically the reverse, Zope OFS -provides a FS view on objects, SOPE OFS provides an object view on FS objects) - -Note that you can use any filemanager class as a storage for SOPE objects, not -only NSFileManager, eg NGImap4FileManager or NGLdapFileManager. On the other -side you are not required to use OFS for storing SOPE objects. - -OFS itself does no caching and conflict detection beyond the life of the -context, this is the task of either an own OFS subclass or of the filemanager -depending on the requirements. - -Class Hierarchy: - OFSBaseObject (keeps name, container, fm and storage path) - OFSFile (has a BLOB and attributes) - OFSImage (different class since different methods are bound) - OFSPropertyListObject (objects stored as a plist) - OFSWebMethod (handles component templates inside OFS) - OFSFolder (collections of OFSFile's and OFSFolder's) - OFSFactoryContext (keeps instantiation state) - OFSFactoryRegistry (select a factory object) ============================================================ --- sope-appserver/SoOFS/SoOFS-Info.plist 5fbedd410c66eb6f3ee5d3068391755fe0194cfc +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - SoOFS - CFBundleGetInfoString - - CFBundleIdentifier - org.OpenGroupware.SOPE.appserver.SoOFS - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 4.5 - - ============================================================ --- sope-appserver/SoOFS/SoOFS-SXP-Info.plist cea1f2c13b913eb0e70c8c08a4732c0abaf74149 +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - SoOFS - CFBundleGetInfoString - - CFBundleIconFile - - CFBundleIdentifier - org.OpenGroupware.SOPE.SoOFS - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 4.2 - NSPrincipalClass - SoOFSProduct - - ============================================================ --- sope-appserver/SoOFS/SoOFS.h 6b98748436bcb3e0611b5ad3e5f9546a0c9ffdfb +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGObjWeb_SoOFS_H__ -#define __NGObjWeb_SoOFS_H__ - -#include -#include -#include -#include -#include -#include -#include - -#endif /* __NGObjWeb_SoOFS_H__ */ ============================================================ --- sope-appserver/SoOFS/SoOFSProduct.m 65c0ef4ba7feec5eb9a75c3f94e33a139a923f09 +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import - -/* - Note: do not include that file in the subproject, it is linked in the - product bundle -*/ - -@interface SoOFSProduct : NSObject -@end - -@implementation SoOFSProduct -@end /* SoOFSProduct */ ============================================================ --- sope-appserver/SoOFS/TODO bc357ec57b9b321b50af66920d1359d6df9e252d +++ /dev/null @@ -1,48 +0,0 @@ -Todo's for SOPE OFS - -- distinguish between WebMethods and WebDocuments !!! WebMethods operate - on the 'clientObject' while WebDocuments operate on themselves (eg - /a/b.wox - if b.wox is a method, the clientObject is 'a') - -- currently OFSImage/OFSFile "GET" returns a WOResponse, it should return - itself and the SOPE rendering step should morph the OFSImage into a - WOResponse, this way we are much more flexible in handling (eg a renderer - could convert or compress an image on the fly) - [DONE?] - -- autodetect "special" versioned folders based on ".svn" and "CVS", this - should be supported in the core to trigger categories based on that ? - [DONE?] - -- add some caching logic, eg a "cached" filemanager which wraps an - NGFileManager (remember, SOPE objects itself should be controller !) - -- OFSImage/OFSFile (or their renderer) should properly deliver the last - modified and etag HTTP headers - -- add MIME-type mapping to OFSFile/OFSImage using /etc/mime.types - -- store permissions of objects in folders (special file ?) - - acquire object permissions from parent folders ? - -- a "property storage" object for abstracting where OFS properties are - stored: - - in a plist file - - in Subversion - - in ... - The property storage should not be fixed on the OFS SoClass ! - -- add support for Zope Page Template syntax (create a WOxElementBuilder for - the tal: namespace) - -- add a dynamic element for "rendering" HTTP headers, eg: - - -- add an XSLT method using libxml2 - -- add a PHP OFS method - - how to apply templates ? - - internal redirect ? - -- add support for "source.html", like in Zope - - edit raw source of a document ============================================================ --- sope-appserver/SoOFS/Version 550e885075f13411bcc2bf132aa57dda6d1da161 +++ /dev/null @@ -1,5 +0,0 @@ -# version file - -SUBMINOR_VERSION:=25 - -# v4.5.23 requires libNGObjWeb v4.5.263 ============================================================ --- sope-appserver/SoOFS/common.h 99d86d98b8dac7cd575965ba371f49d190fdf83b +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __SoOFS_common_H__ -#define __SoOFS_common_H__ - -#import - -#if NeXT_Foundation_LIBRARY || APPLE_FOUNDATION_LIBRARY || \ - COCOA_Foundation_LIBRARY -#define COCOA_Foundation_LIBRARY 1 - -# include -# include -#endif - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef COMPILE_FOR_GSTEP_MAKE -# include "WOContext+private.h" // required for page rendering -#else -/* Xcode can't reference the private header, so as a workaround we declare all - private methods used here */ -# include -@interface WOContext(UsedPrivates) -- (void)enterComponent:(WOComponent *)_component content:(WOElement *)_content; -- (void)leaveComponent:(WOComponent *)_component; -- (void)setPage:(WOComponent *)_page; -@end -#endif - -@interface WOContext(LastException) -- (NSException *)lastException; -@end - -#endif /* __SoOFS_common_H__ */ ============================================================ --- sope-appserver/SoOFS/fhs.make 6cd4c7a197554856b80643b92393ab7b06ca0101 +++ /dev/null @@ -1,64 +0,0 @@ -# postprocessing - -# FHS support (this is a hack and is going to be done by gstep-make!) - -ifneq ($(FHS_INSTALL_ROOT),) - -FHS_INCLUDE_DIR=$(FHS_INSTALL_ROOT)/include/ -FHS_BIN_DIR=$(FHS_INSTALL_ROOT)/bin/ -FHS_SBIN_DIR=$(FHS_INSTALL_ROOT)/sbin/ - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib64/ -else -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ -endif -FHS_SO_DIR=$(FHS_LIB_DIR)sope-$(MAJOR_VERSION).$(MINOR_VERSION)/products/ - -NONFHS_LIBDIR="$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)/" -NONFHS_LIBNAME="$(LIBRARY_NAME)$(LIBRARY_NAME_SUFFIX)$(SHARED_LIBEXT)" -NONFHS_BINDIR="$(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)" - - -fhs-header-dirs :: - $(MKDIRS) $(FHS_INCLUDE_DIR)$(libSoOFS_HEADER_FILES_INSTALL_DIR) - -fhs-bin-dirs :: - $(MKDIRS) $(FHS_BIN_DIR) - -fhs-sbin-dirs :: - $(MKDIRS) $(FHS_SBIN_DIR) - -fhs-products-dirs :: - $(MKDIRS) $(FHS_SO_DIR) - - -move-headers-to-fhs :: fhs-header-dirs - @echo "moving headers to $(FHS_INCLUDE_DIR) .." - mv $(GNUSTEP_HEADERS)$(libSoOFS_HEADER_FILES_INSTALL_DIR)/*.h \ - $(FHS_INCLUDE_DIR)$(libSoOFS_HEADER_FILES_INSTALL_DIR)/ - -move-libs-to-fhs :: - @echo "moving libs to $(FHS_LIB_DIR) .." - mv $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ - -move-daemons-to-fhs :: fhs-sbin-dirs - @echo "moving daemons from $(NONFHS_BINDIR) to $(FHS_SBIN_DIR) .." - for i in $(TOOL_NAME); do \ - mv "$(NONFHS_BINDIR)/$${i}" $(FHS_SBIN_DIR); \ - done - -move-bundles-to-fhs :: fhs-products-dirs - @echo "moving bundles $(BUNDLE_INSTALL_DIR) to $(FHS_SO_DIR) .." - for i in $(BUNDLE_NAME); do \ - j="$(FHS_SO_DIR)/$${i}$(BUNDLE_EXTENSION)"; \ - if test -d $$j; then rm -r $$j; fi; \ - mv "$(BUNDLE_INSTALL_DIR)/$${i}$(BUNDLE_EXTENSION)" $$j; \ - done - -move-to-fhs :: move-headers-to-fhs move-libs-to-fhs move-daemons-to-fhs \ - move-bundles-to-fhs - -after-install :: move-to-fhs - -endif ============================================================ --- sope-appserver/SoOFS/product.plist 4fee4fa06b5007bed869ace8a7d202e4f00fc771 +++ /dev/null @@ -1,110 +0,0 @@ -{ - requires = ( SoCore ); - - classes = { - - OFSBaseObject = { - protectedBy = ""; - - methods = { - DELETE = { protectedBy = "Delete Objects"; }; - }; - }; - - OFSFile = { - protectedBy = ""; - - methods = { - GET = { - protectedBy = "View"; - }; - view = { - protectedBy = "View"; - }; - DELETE = { - protectedBy = "Delete Objects"; - }; - PUT = { - protectedBy = "Change Images and Files"; - }; - }; - - defaultRoles = { - "WebDAV Access" = "Authenticated"; - "Change Images and Files" = "Owner"; - "Delete Objects" = "Owner"; - "View" = "Owner"; - "WebDAV Lock Items" = "Authenticated"; - "WebDAV Unlock Items" = "Authenticated"; - }; - }; - - OFSPropertyListObject = { - protectedBy = ""; - defaultAccess = "allow"; - extension = plist; - }; - - OFSImage = { - protectedBy = ""; - defaultAccess = "allow"; - extensions = ( gif, jpg, jpeg, png, ico ); - }; - - OFSFolder = { - protectedBy = ""; - defaultAccess = "allow"; - - methods = { - GET = { - protectedBy = "View"; - }; - PUT = { - protectedBy = "Change Images and Files"; - }; - DELETE = { - protectedBy = "Delete Objects"; - }; - MKCOL = { - protectedBy = "Add Folders"; - }; - }; - - defaultRoles = { - "WebDAV Access" = "Authenticated"; - "Change Images and Files" = "Owner"; - "Delete Objects" = "Owner"; - "View" = "Owner"; - "Add Documents, Images and Files" = "Owner"; - "Add Folders" = "Owner"; - }; - }; - - OFSWebMethod = { - protectedBy = ""; - defaultAccess = "allow"; - extensions = ( wox ); - }; - OFSWebDocument = { - protectedBy = ""; - defaultAccess = "allow"; - extensions = ( xhtml ); - }; - OFSWebTemplate = { - protectedBy = ""; - defaultAccess = "allow"; - extensions = ( xtmpl ); - }; - - OFSHttpPasswd = { - protectedBy = ""; - defaultAccess = "deny"; - extensions = ( htpasswd ); // either blah.htpasswd - exactFilenames = ( htpasswd ); // or just "htpasswd" - }; - OFSChangeLog = { - extensions = ( changelog ); // either blah.changelog - exactFilenames = ( ChangeLog ); // or just "ChangeLog" - }; - }; -} ============================================================ --- sope-appserver/SoOFS/sope.8 ffdae2bfe945002433783791ed72feabca1dd001 +++ /dev/null @@ -1,63 +0,0 @@ -.TH sope 8 "October 2004" OpenGroupware.org "User Manuals" -.\" Copyright (c) 2004 Helge Hess. All rights reserved. -.\" ==================================================================== -.\" -.\" Copyright (c) 2004 Helge Hess. All rights reserved. -.\" -.\" Check the COPYING file for further information. -.\" -.\" Created with the help of: -.\" http://www.schweikhardt.net/man_page_howto.html -.\" - -.SH NAME -sope-4.5 \- A tool to serve template based SOPE sites. -.SH SYNOPSIS -.B sope-4.5 -[ -.BI \-WOPort " port" -] - -.SH DESCRIPTION -.B sope-4.5 -is a generic server to serve SOPE applications composed of just templates -and products. -.PP -Note that you should not connect -.B sope-4.5 -directly on its port using your client, but rather use -.B mod_ngobjweb -in combination with -.B Apache. - -.SH OPTIONS -.TP 12 -.IP "-WOPort port" -This option sets the TCP/IP port the -.B sope-4.5 -server is running on and which the mod_ngobjweb will connect to. - -.SH FILES -.I /etc/opengroupware.org/NSGlobalDomain.plist -.RS -This file contains configurations which apply to all SOPE related daemons. -.RE -.I /etc/opengroupware.org/sope-4.5.plist -.RS -Configurations contained in this file overwrite those in the NSGlobalDomain. -You can persist any command line option in this file using the -.BR Defaults (5) -tool. -.RE - -.SH BUGS -SOPE bugs are collected in the OpenGroupware.org Bugzilla: - http://bugzilla.opengroupware.org/ - -.SH AUTHOR -Helge Hess - -.SH SEE ALSO -.BR httpd (8), -.BR sope-ngobjweb-defaults (8), -.BR Defaults (5). ============================================================ --- sope-appserver/SoOFS/sope.m e9363c4d70e13a91dbb16ef0298a55b30e17c2aa +++ /dev/null @@ -1,277 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include - -/* - An executable which can run a SoOFS based SOPE application. When started, - it takes the current-directory path for constructing the SoOFS root folder - of the SOPE application. - It also reads a file ".sope.plist" in the root-path to load site-local - configuration settings. - - TODO: - - load defaults from root-folder - DONE [".sope.plist" is loaded and registered] - - load products from root-folder - - load authenticator from root-folder -*/ - -@class NSString, NSFileManager; - -@interface SOPE : SoApplication -{ - NSFileManager *fm; - NSString *rootPath; -} - -@end - -#include -#include "OFSFolder.h" -#include "OFSFactoryContext.h" -#include "common.h" - -NSString *SoRootFolder = @"SoRootFolder"; - -@implementation SOPE - -static BOOL debugRootObject = NO; - -+ (void)initialize { - /* - Since we are a tool, we have no bundle and need to declare security info - manually ... - */ - SoClassSecurityInfo *si = [self soClassSecurityInfo]; - [si declareObjectPublic]; - [si setDefaultAccess:@"allow"]; -} - -- (void)loadLocalDefaults:(NSString *)_path { - NSDictionary *plist; - - if ((plist = [[NSDictionary alloc] initWithContentsOfFile:_path]) == nil) { - [self logWithFormat:@"could not read SOPE config: %@", _path]; - return; - } - /* - TODO: we need a separate domain for this, this stuff doesn't make sense - at all ... - */ - [[NSUserDefaults standardUserDefaults] registerDefaults:plist]; - [self logWithFormat:@"registered site defaults: %@", _path]; - [plist release]; -} - -- (BOOL)_bootstrap { - // TODO: create some bootstrap code to create initial user database, - // defaults, control-panel, etc - return YES; -} - -- (BOOL)_setupRoot { - BOOL isDir; - - /* setup root path */ - - if (self->fm == nil) { - [self logWithFormat:@"missing SOPE storage filemanager."]; - return NO; - } - if ([self->rootPath length] == 0) { - [self logWithFormat:@"missing SOPE storage root-path."]; - return NO; - } - - if (![self->fm fileExistsAtPath:self->rootPath isDirectory:&isDir]) { - [self logWithFormat:@"SOPE storage root-path does not exist: %@", - self->rootPath]; - return NO; - } - if (!isDir) { - [self logWithFormat:@"SOPE storage root-path is not a directory: %@", - self->rootPath]; - return NO; - } - - /* bootstrap root if necessary */ - - if (![self _bootstrap]) - return NO; - - /* configure */ - - [self logWithFormat:@"starting SOPE on OFS root: %@", self->rootPath]; - - return YES; -} - -- (void)registerUserDefaults { - NSString *p; - - [super registerUserDefaults]; - p = [self->rootPath stringByAppendingPathComponent:@".sope.plist"]; - if ([self->fm isReadableFileAtPath:p]) - [self loadLocalDefaults:p]; -} - -- (id)init { - // TODO: make root-path/fm configurable ? - self->fm = [[NSFileManager defaultManager] retain]; - self->rootPath = [[self->fm currentDirectoryPath] copy]; - - if (![self _setupRoot]) { - [self release]; - return nil; - } - /* Q: Why is [super init] done so goddamn late? - A: In the process of setting up or root directory, we're also registering - defaults. These defaults are important for the inits done by super, - so we need to do this in advance. - */ - [super init]; - return self; -} - -- (void)dealloc { - [self->fm release]; - [self->rootPath release]; - [super dealloc]; -} - -/* accessors */ - -- (id)fileManager { - return self->fm; -} -- (NSString *)rootPath { - return self->rootPath; -} - -/* define the root SoObject */ - -- (id)rootObjectInContext:(id)_ctx { - OFSFactoryContext *ctx; - OFSFolder *root; - - if (debugRootObject) [self logWithFormat:@"queried root object ..."]; - - if ((root = [_ctx valueForKey:SoRootFolder]) != nil) { - if (debugRootObject) - [self logWithFormat:@" using cached root object: %@", root]; - return root; - } - - ctx = [OFSFactoryContext contextWithFileManager:[self fileManager] - storagePath:[self rootPath]]; - - root = [[[OFSFolder alloc] init] autorelease]; - [root takeStorageInfoFromContext:ctx]; - [root awakeFromFetchInContext:ctx]; - [_ctx takeValue:root forKey:SoRootFolder]; - if (debugRootObject) - [self logWithFormat:@" created new root object: %@", root]; - return root; -} - -/* security */ - -- (id)authenticatorInContext:(id)_ctx { - id root; - id auth; - - root = [self rootObjectInContext:_ctx]; - if ((auth = [root authenticatorInContext:_ctx])) - return auth; - - return [super authenticatorInContext:_ctx]; -} - -/* SMI */ - -- (NSArray *)manageMenuChildNames { - NSMutableArray *ma; - id root; - - ma = [NSMutableArray arrayWithCapacity:16]; - [ma addObject:@"ControlPanel"]; - - root = [self rootObjectInContext:[self context]]; - if (root != nil && (root != self)) - [ma addObjectsFromArray:[root toOneRelationshipKeys]]; - - return ma; -} - -/* MacOSX support */ - -- (id)handleQueryWithUnboundKey:(NSString *)key { - /* KVC on MacOSX throws an exception when an unbound key is queried ... */ - return nil; -} - -@end /* SOPE */ - -int main(int argc, char **argv, char **env) { - NSAutoreleasePool *pool; - NSEnumerator *args; - NSString *arg; - id self; - - pool = [[NSAutoreleasePool alloc] init]; -#if LIB_FOUNDATION_LIBRARY - [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; -#endif - - self = pool; - args = [[[NSProcessInfo processInfo] arguments] objectEnumerator]; - [args nextObject]; - - while ((arg = [args nextObject]) != nil) { - if ([arg isEqualToString:@"--bundle"]) { - NSString *path = [args nextObject]; - if (path != nil) { - NSBundle *bundle; - bundle = [NSBundle bundleWithPath:path]; - if (!bundle) { - [self errorWithFormat:@"No loadable bundle at path: '%@'!", path]; - exit(1); - } - [bundle load]; - } - else { - [self errorWithFormat:@"Missing path for --bundle argument!"]; - exit(1); - } - } -#if 0 - else { - [self errorWithFormat:@"Unknown argument: '%@', skipping.", arg]; - } -#endif - } - - WOWatchDogApplicationMain(@"SOPE", argc, (void*)argv); - - [pool release]; - return 0; -} ============================================================ --- sope-appserver/WEPrototype/COPYING a8ecc64ae8f66862b50811abfb6be67cd46e42fe +++ /dev/null @@ -1,485 +0,0 @@ -IMPORTANT NOTE: the prototype JavaScript source has a different license. - - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! ============================================================ --- sope-appserver/WEPrototype/COPYRIGHT f7c377dbd6053862e7e671593f5df0060b551a74 +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (C) 2005 Helge Hess -Contact: helge.hess@opengroupware.org - -The JavaScript Prototype library sources are: -Copyright (c) 2005 Sam Stephenson - -Please see the LICENSE file in the prototype subdirectory. ============================================================ --- sope-appserver/WEPrototype/ChangeLog c91f53e1ef0beba9d5e6257cca0acd2cdeb2ba10 +++ /dev/null @@ -1,52 +0,0 @@ -2010-10-06 Wolfgang Sourdeau - - * js2m.sh (mfile): fixed generation of line endings. - -2007-03-17 Marcus Mueller - - * WEPrototypeScript.m, WELiveLink.m: obey WOContext's new - -isRenderingDisabled flag (v4.7.9) - -2006-08-28 Marcus Mueller - - * WEPrototypeElemBuilder.m: added "prototype-script" reference to - WEPrototypeScript element. (v4.5.8) - -2006-02-20 Helge Hess - - * GNUmakefile: link WEPrototypeElemBuilder into libWEPrototype, - properly protect framework settings (v4.5.7) - -2005-09-18 Helge Hess - - * GNUmakefile.preamble: fixed for framework compilation (v4.5.6) - -2005-09-15 Helge Hess - - * GNUmakefile.preamble, GNUmakefile.postamble: moved targets from - pre- to postamble (v4.5.5) - -2005-07-22 Helge Hess - - * WEPrototypeScriptAction.m: improved check of if-none-match header - (v4.5.4) - -2005-07-14 Helge Hess - - * added Scriptaculous library v1.0.0 (v4.5.3) - -2005-07-11 Helge Hess - - * updated to Prototype library v1.3.1 (v4.5.2) - -2005-07-11 Marcus Mueller - - * WEPrototype-Info.plist: bundle description for Xcode - - * WEPrototype.xcodeproj: new Xcode 2.1 project - -2005-07-10 Helge Hess - - * imported Prototype library v1.2.0 - - * created project ============================================================ --- sope-appserver/WEPrototype/GNUmakefile 08ce40b62bfabbe0c461f665a4a7bee53951159b +++ /dev/null @@ -1,58 +0,0 @@ -# GNUstep makefile - -include ../../config.make -include $(GNUSTEP_MAKEFILES)/common.make -include ../Version -include ./Version - -ifneq ($(frameworks),yes) -LIBRARY_NAME = libWEPrototype - -BUNDLE_NAME = WEPrototype -BUNDLE_EXTENSION = .wox -BUNDLE_INSTALL_DIR = $(SOPE_WOXBUILDERS)/ -else -FRAMEWORK_NAME = WEPrototype -endif - -FHS_MANPAGES += doc/*.3 - -libWEPrototype_PCH_FILE = common.h -WEPrototype_PCH_FILE = common.h -libWEPrototype_HEADER_FILES_DIR = . -libWEPrototype_HEADER_FILES_INSTALL_DIR = /WEPrototype - -libWEPrototype_HEADER_FILES = - -libWEPrototype_OBJC_FILES = \ - WEPrototypeScriptAction.m \ - WEPrototypeScript.m \ - WELiveLink.m \ - WEPrototypeElemBuilder.m \ - -WEPrototype_OBJC_FILES = WEPrototypeBundle.m -WEPrototype_PRINCIPAL_CLASS = WEPrototypeBundle - -# framework support - -ifeq ($(frameworks),yes) -WEPrototype_HEADER_FILES_DIR = WEPrototype -WEPrototype_HEADER_FILES = $(libWEPrototype_HEADER_FILES) -WEPrototype_OBJC_FILES = $(libWEPrototype_OBJC_FILES) -WEPrototype_SUBPROJECTS = $(libWEPrototype_SUBPROJECTS) -endif - - -# building - --include GNUmakefile.preamble -ifneq ($(FHS_INSTALL_ROOT),) -GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include -endif -ifneq ($(frameworks),yes) -include $(GNUSTEP_MAKEFILES)/library.make -include $(GNUSTEP_MAKEFILES)/bundle.make -else -include $(GNUSTEP_MAKEFILES)/framework.make -endif --include GNUmakefile.postamble ============================================================ --- sope-appserver/WEPrototype/GNUmakefile.postamble be6a3224b27e6ec207caeec505179aa6ca5a8d79 +++ /dev/null @@ -1,20 +0,0 @@ -# postprocessing makefile - -WEPrototypeScript.jsm : prototype/prototype.js js2m.sh - sh js2m.sh $< $@ - touch WEPrototypeScript.m - -WEPrototypeScriptAction.m : WEPrototypeScript.jsm - -before-all :: WEPrototypeScript.jsm - - -ifneq ($(GNUSTEP_BUILD_DIR),) -after-WEPrototype-all :: - @(cp bundle-info.plist \ - $(GNUSTEP_BUILD_DIR)/$(BUNDLE_NAME)$(BUNDLE_EXTENSION)) -else -after-WEPrototype-all :: - @(cd $(BUNDLE_NAME)$(BUNDLE_EXTENSION);\ - cp ../bundle-info.plist .) -endif ============================================================ --- sope-appserver/WEPrototype/GNUmakefile.preamble 7b2844d312405bca256481fa75c6be7cae7f30db +++ /dev/null @@ -1,99 +0,0 @@ -# GNUstep makefile - -SOPE_ROOT=../.. - -# TODO: remove for framework builds? -ADDITIONAL_CPPFLAGS += \ - -DCOMPILE_FOR_GSTEP_MAKE=1 - -ADDITIONAL_CPPFLAGS += \ - -Wall \ - -DSOPE_MAJOR_VERSION=$(MAJOR_VERSION) \ - -DSOPE_MINOR_VERSION=$(MINOR_VERSION) \ - -DWEP_SUBMINOR_VERSION=$(SUBMINOR_VERSION) - -ADDITIONAL_CPPFLAGS += -Wall -ADDITIONAL_INCLUDE_DIRS += \ - -I.. -I$(SOPE_ROOT) -I../NGObjWeb \ - -I$(SOPE_ROOT)/sope-core/NGStreams \ - -I$(SOPE_ROOT)/sope-core/NGExtensions \ - -I$(SOPE_ROOT)/sope-core \ - -I$(SOPE_ROOT)/sope-xml - - -libWEPrototype_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION) -libWEPrototype_INSTALL_DIR=$(SOPE_SYSLIBDIR) -libWEPrototype_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION) - -libWEPrototype_LIBRARIES_DEPEND_UPON += \ - -lNGObjWeb \ - -lNGMime \ - -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC - - -ifeq ($(frameworks),yes) -WEPrototype_LIBRARIES_DEPEND_UPON += \ - -framework NGObjWeb \ - -framework NGMime -framework NGMail \ - -framework NGStreams -framework NGExtensions -framework EOControl \ - -framework XmlRpc -framework DOM -framework SaxObjC -endif - - -# library/framework search pathes - -DEP_DIRS = \ - ../NGObjWeb \ - $(SOPE_ROOT)/sope-mime \ - $(SOPE_ROOT)/sope-mime/NGMail \ - $(SOPE_ROOT)/sope-core/NGStreams \ - $(SOPE_ROOT)/sope-core/NGExtensions \ - $(SOPE_ROOT)/sope-core/EOControl \ - $(SOPE_ROOT)/sope-xml/DOM \ - $(SOPE_ROOT)/sope-xml/XmlRpc \ - $(SOPE_ROOT)/sope-xml/SaxObjC - -ifneq ($(frameworks),yes) -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),\ - -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME)) -else -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) -endif - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64 -else -SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib -endif - - -# bundle dependencies - -ifneq ($(frameworks),yes) - -WEPrototype_BUNDLE_LIBS += \ - -lWEPrototype \ - -lNGObjWeb \ - -lNGMime \ - -lNGStreams -lNGExtensions -lEOControl \ - -lXmlRpc -lDOM -lSaxObjC -WEPrototype_WOBUNDLE_LIBS += $(WEPrototype_BUNDLE_LIBS) - -ifneq ($(GNUSTEP_BUILD_DIR),) -WEPrototype_LIB_DIRS += -L$(GNUSTEP_OBJ_DIR) -else -WEPrototype_LIB_DIRS += -L./$(GNUSTEP_OBJ_DIR) -endif - -endif - - -# Apple - -#ifeq ($(FOUNDATION_LIB),apple) -#libWEPrototype_PREBIND_ADDR="TODO TODO" -#libWEPrototype_LDFLAGS += -seg1addr $(libWEPrototype_PREBIND_ADDR) -#endif ============================================================ --- sope-appserver/WEPrototype/README def012c8755c601442c52278ebc6a47e8586c724 +++ /dev/null @@ -1,174 +0,0 @@ -WEPrototype -=========== - -This framework contains dynamic elements wrapping and connecting the -excellent Prototype JavaScript library. - -http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptHelper.html#M000394 - -Prototype functions -=================== - -Prototype -========= - -Prototype -- 'Version' property - -Class - .create() - -Abstract - -[Object] - .extend(otherobject) - copy properties of 'otherobject' to receiver - -[Function] - .bind(object) - .bindAsEventListener(object) - -[Number] - .toColorPart() - -Try - -PeriodicalExecuter - .initialize(callback, frequency) - .registerCallback() - .onTimerEvent - -$(...) -- run getElementById() for arguments -- return array for multiple, a single for one - - -Form -==== - -Field - .clear(...) - resolve names using $() and reset value - eg: Field.clear("sender", "from", "to") - .present(...) - check whether all elements have values - .focus(element) - lookup element using $() and focus - .select(element) - lookup element using $() and select - .activate(element) - lookup element using $() and focus+select - -Form - .serialize(form) - .getElements(form) - .disable(form) - .focusFirstElement(form) - .reset(form) - -Form.Element - .serialize(element) - .getValue(element) - -Form.Element.Serializers - -Abstract.TimedObserver - .initialize(element, frequency, callback) - -Form.Element.Observer : Abstract.TimedObserver - .getValue - -Form.Observer : Abstract.TimedObserver - .getValue - - -AJAX -==== - -Ajax.getTransport() -- return XMLHTTP object depending on browser - -Ajax.Base() - .setOptions(dict) - method - post - asynchronous - true - parameters - '' - -Ajax.Request() - - states: Uninitialized, Loading, Loaded, Interactive, Complete - .initialize(url, options) - -Ajax.Updater() - .initialize(container, url, options) - options: - - Base options - 'insertion' => function(container, responseText) => default: .innerHTML - - -Effects -======= -TODO - - -DOM -=== - -document.getElementsByClasName(className) - -Element - .toggle(...) - toggle style between "None" and "" - .hide(...) - .show(...) - .remove(elemName) - removed named element (lookup using $()) - .getHeight(elemName) - -Toggle - .display(..) - same like Element.toggle() - -Abstract.Insertion(adjacency) - .initialize(element, content) - -Insertion.Before : Abstract.Insertion - -Insertion.Top : Abstract.Insertion - -Insertion.Bottom : Abstract.Insertion - -Insertion.After : Abstract.Insertion - - -Compat -====== -TODO - - -RoR -=== -
- - - (leave url ») - - -link_to_remote word, - :url => { :action => "action" }, - 404 => "alert('Not found...? Wrong URL...?')", - :failure => "alert('HTTP Error ' + request.status + '!')" - - -link_to_remove - :url - :update - :update => "emails" - or - :update => { :success => "posts", :failure => "error" } - :position - - :before, :top, :bottom, :after - Callbacks - :complete - :loading - :loaded - :interactive - :failure - :confirm - add confirmation dialog - :condition - :before - before request is initiated - :after - after request was initiated and before :loading ============================================================ --- sope-appserver/WEPrototype/Version e5a7ee370073b2dbf9a96d03964a1933a9f158f0 +++ /dev/null @@ -1,6 +0,0 @@ -# version file - -SUBMINOR_VERSION:=9 - -# v4.7.9 requires libNGObjWeb v4.7.5 -# v4.5.1 requires libNGObjWeb v4.5.170 ============================================================ --- sope-appserver/WEPrototype/WELiveLink.m 0f1691c61fa0a3703ca5ce08948a745077ab7e05 +++ /dev/null @@ -1,219 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import - -/* - WELiveLink - - Inspired by the link_to_remote() RoR function. - - position := { Before, Top, Bottom, After } -*/ - -@interface WELiveLink : WODynamicElement -{ - WOAssociation *string; - WOAssociation *updateID; - WOAssociation *position; - - WOAssociation *actionClass; - WOAssociation *directActionName; - WOAssociation *href; - - WOAssociation *confirmText; - - WOElement *template; -} - -@end - -#include "WEPrototypeScript.h" -#include "common.h" - -@implementation WELiveLink - -- (id)initWithName:(NSString *)_name - associations:(NSDictionary *)_config - template:(WOElement *)_tmp -{ - if ((self = [super initWithName:_name associations:_config template:_tmp])) { - self->template = [_tmp retain]; - - self->string = WEPExtGetProperty(_config, @"string"); - self->updateID = WEPExtGetProperty(_config, @"updateID"); - self->position = WEPExtGetProperty(_config, @"position"); - self->actionClass = WEPExtGetProperty(_config, @"actionClass"); - self->directActionName = WEPExtGetProperty(_config, @"directActionName"); - self->href = WEPExtGetProperty(_config, @"href"); - self->confirmText = WEPExtGetProperty(_config, @"confirmText"); - } - return self; -} - -- (void)dealloc { - [self->updateID release]; - [self->position release]; - [self->actionClass release]; - [self->directActionName release]; - [self->href release]; - [self->confirmText release]; - [self->string release]; - [self->template release]; - [super dealloc]; -} - -/* generating response */ - -- (NSString *)linkInContext:(WOContext *)_ctx { - if (self->directActionName != nil) { - NSString *ac, *da; - - ac = [self->actionClass stringValueInComponent:[_ctx component]]; - da = [self->directActionName stringValueInComponent:[_ctx component]]; - - if ([ac length] > 0) - da = [[ac stringByAppendingString:@"/"] stringByAppendingString:da]; - - return [_ctx directActionURLForActionNamed:da queryDictionary:nil]; - } - - if (self->href != nil) - return [self->href stringValueInComponent:[_ctx component]]; - - [self logWithFormat:@"ERROR: no binding for link!"]; - return nil; -} - -- (void)appendJavaScriptToResponse:(WOResponse *)_response - inContext:(WOContext *)_ctx -{ - /* - new Ajax.Updater('time_div', - '/hello_world/say_when', - {insertion:Insertion.After, asynchronous:true}); - return false; - */ - WOComponent *sComponent; - NSString *s; - BOOL closeBracket = NO, isDOM = NO; - - sComponent = [_ctx component]; - - /* check for confirm panel */ - - s = [self->confirmText stringValueInComponent:sComponent]; - if ([s length] > 0) { - [_response appendContentString:@"if (confirm('"]; - [_response appendContentHTMLAttributeValue:s]; - [_response appendContentString:@"')) { "]; - closeBracket = YES; - } - - /* whether to update an element */ - - s = [self->updateID stringValueInComponent:sComponent]; - if ([s length] > 0) { - [_response appendContentString:@"new Ajax.Updater('"]; - [_response appendContentHTMLAttributeValue:s]; - [_response appendContentString:@"', '"]; - isDOM = YES; - } - else { - [_response appendContentString:@"new Ajax.Request('"]; - } - - /* Link */ - - if ((s = [self linkInContext:_ctx]) != nil) - [_response appendContentHTMLAttributeValue:s]; - [_response appendContentString:@"'"]; - - /* parameters */ - - [_response appendContentString:@", {"]; - - if (isDOM) { - s = [self->position stringValueInComponent:sComponent]; - if ([s length] > 0) { - [_response appendContentString:@"insertion: Insertion."]; - [_response appendContentString:[s capitalizedString]]; - [_response appendContentString:@", "]; - } - } - - [_response appendContentString:@"asynchronous: true }"]; - - /* close function */ - - [_response appendContentString:@");"]; - - /* close confirm panel if */ - - if (closeBracket) [_response appendContentString:@"}"]; - - /* always: do not follow link target */ - [_response appendContentString:@" return false;"]; -} - -- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { - NSString *s; - - if ([_ctx isRenderingDisabled]) { - [self->template appendToResponse:_response inContext:_ctx]; - return; - } - - /* first ensure that prototype is loaded */ - [WEPrototypeScript appendToResponse:_response inContext:_ctx]; - - /* start link tag */ - - [_response appendContentString:@"otherTagString != nil) { - [_response appendContentString:@" "]; - s = [self->otherTagString stringValueInComponent:[_ctx component]]; - [_response appendContentString:s]; - } - [_response appendContentString:@">"]; - - /* generate content */ - - if ((s = [self->string stringValueInComponent:[_ctx component]]) != nil) - [_response appendContentHTMLString:s]; - - [self->template appendToResponse:_response inContext:_ctx]; - - /* close anker */ - [_response appendContentString:@""]; -} - -@end /* WELiveLink */ ============================================================ --- sope-appserver/WEPrototype/WEPrototype-Info.plist 938f11c61fb76d9f8657a7d885383d2b0ad5a2ba +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - WEPrototype - CFBundleGetInfoString - - CFBundleIdentifier - org.OpenGroupware.SOPE.appserver.WEPrototype - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 4.5 - - ============================================================ --- sope-appserver/WEPrototype/WEPrototypeBundle.m b2177df05d77029c6ab3fd48dbdd96790b743670 +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import - -@interface WEPrototypeBundle : NSObject -@end - -@implementation WEPrototypeBundle -@end /* WEPrototypeBundle */ ============================================================ --- sope-appserver/WEPrototype/WEPrototypeElemBuilder.m a0451ef3abc65c82b471e39be3a4fda96d010543 +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include - -/* - This builder builds various elements from the WEPrototype library. - - All tags are mapped into the namespace (XMLNS_OD_BIND). - - Supported tags: - var:live-link => WELiveLink -*/ - -@interface WEPrototypeElemBuilder : WOxTagClassElemBuilder -{ -} - -@end - -#include -#include "common.h" - -@implementation WEPrototypeElemBuilder - -- (Class)classForElement:(id)_element { - NSString *tagName; - unsigned tl; - unichar c1; - - if (![[_element namespaceURI] isEqualToString:XMLNS_OD_BIND]) - return Nil; - - tagName = [_element tagName]; - if ((tl = [tagName length]) < 2) - return Nil; - - c1 = [tagName characterAtIndex:0]; - - switch (c1) { - case 'p': - if ([tagName isEqualToString:@"prototype-script"]) - return NSClassFromString(@"WEPrototypeScript"); - case 'l': - if ([tagName isEqualToString:@"live-link"]) - return NSClassFromString(@"WELiveLink"); - default: - return Nil; - } -} - -@end /* WEPrototypeElemBuilder */ ============================================================ --- sope-appserver/WEPrototype/WEPrototypeScript.api 3c591b6480e52981ed7ecadd8f4d640c055e97f0 +++ /dev/null @@ -1,4 +0,0 @@ - - - - ============================================================ --- sope-appserver/WEPrototype/WEPrototypeScript.h 43dd2653b19d0bffbefe96caa2f0cffff21db9fc +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WEPrototypeScript_H__ -#define __WEPrototypeScript_H__ - -#import - -/* - WEPrototypeScript - - Generates a link to the direct action which delivers the prototype.js file. - - The method is also exposed as a class method so that other methods can - trigger it. It will generate its content only once (protected by a context - variable). -*/ - -@class WOContext, WOResponse; - -@interface WEPrototypeScript : WODynamicElement -{ -} - -+ (BOOL)wasDeliveredInContext:(WOContext *)_ctx; -+ (void)markDeliveredInContext:(WOContext *)_ctx; -+ (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx; - -@end - -#endif /* __WEPrototypeScript_H__ */ ============================================================ --- sope-appserver/WEPrototype/WEPrototypeScript.jsm a3c0878ec3577ac7781201146ea1f9267114d13c +++ /dev/null @@ -1,901 +0,0 @@ -/* automatically generated from prototype/prototype.js, do not edit ! */ -@"/* Prototype JavaScript framework, version 1.3.1\n" -@" * (c) 2005 Sam Stephenson \n" -@" *\n" -@" * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff\n" -@" * against the source tree, available from the Prototype darcs repository. \n" -@" *\n" -@" * Prototype is freely distributable under the terms of an MIT-style license.\n" -@" *\n" -@" * For details, see the Prototype web site: http://prototype.conio.net/\n" -@" *\n" -@"/*--------------------------------------------------------------------------*/\n" -@"var Prototype = {\n" -@" Version: '1.3.1',\n" -@" emptyFunction: function() {}\n" -@"}\n" -@"var Class = {\n" -@" create: function() {\n" -@" return function() { \n" -@" this.initialize.apply(this, arguments);\n" -@" }\n" -@" }\n" -@"}\n" -@"var Abstract = new Object();\n" -@"Object.extend = function(destination, source) {\n" -@" for (property in source) {\n" -@" destination[property] = source[property];\n" -@" }\n" -@" return destination;\n" -@"}\n" -@"Object.prototype.extend = function(object) {\n" -@" return Object.extend.apply(this, [this, object]);\n" -@"}\n" -@"Function.prototype.bind = function(object) {\n" -@" var __method = this;\n" -@" return function() {\n" -@" __method.apply(object, arguments);\n" -@" }\n" -@"}\n" -@"Function.prototype.bindAsEventListener = function(object) {\n" -@" var __method = this;\n" -@" return function(event) {\n" -@" __method.call(object, event || window.event);\n" -@" }\n" -@"}\n" -@"Number.prototype.toColorPart = function() {\n" -@" var digits = this.toString(16);\n" -@" if (this < 16) return '0' + digits;\n" -@" return digits;\n" -@"}\n" -@"var Try = {\n" -@" these: function() {\n" -@" var returnValue;\n" -@" for (var i = 0; i < arguments.length; i++) {\n" -@" var lambda = arguments[i];\n" -@" try {\n" -@" returnValue = lambda();\n" -@" break;\n" -@" } catch (e) {}\n" -@" }\n" -@" return returnValue;\n" -@" }\n" -@"}\n" -@"/*--------------------------------------------------------------------------*/\n" -@"var PeriodicalExecuter = Class.create();\n" -@"PeriodicalExecuter.prototype = {\n" -@" initialize: function(callback, frequency) {\n" -@" this.callback = callback;\n" -@" this.frequency = frequency;\n" -@" this.currentlyExecuting = false;\n" -@" this.registerCallback();\n" -@" },\n" -@" registerCallback: function() {\n" -@" setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);\n" -@" },\n" -@" onTimerEvent: function() {\n" -@" if (!this.currentlyExecuting) {\n" -@" try { \n" -@" this.currentlyExecuting = true;\n" -@" this.callback(); \n" -@" } finally { \n" -@" this.currentlyExecuting = false;\n" -@" }\n" -@" }\n" -@" }\n" -@"}\n" -@"/*--------------------------------------------------------------------------*/\n" -@"function $() {\n" -@" var elements = new Array();\n" -@" for (var i = 0; i < arguments.length; i++) {\n" -@" var element = arguments[i];\n" -@" if (typeof element == 'string')\n" -@" element = document.getElementById(element);\n" -@" if (arguments.length == 1) \n" -@" return element;\n" -@" elements.push(element);\n" -@" }\n" -@" return elements;\n" -@"}\n" -@"if (!Array.prototype.push) {\n" -@" Array.prototype.push = function() {\n" -@" var startLength = this.length;\n" -@" for (var i = 0; i < arguments.length; i++)\n" -@" this[startLength + i] = arguments[i];\n" -@" return this.length;\n" -@" }\n" -@"}\n" -@"if (!Function.prototype.apply) {\n" -@" // Based on code from http://www.youngpup.net/\n" -@" Function.prototype.apply = function(object, parameters) {\n" -@" var parameterStrings = new Array();\n" -@" if (!object) object = window;\n" -@" if (!parameters) parameters = new Array();\n" -@" \n" -@" for (var i = 0; i < parameters.length; i++)\n" -@" parameterStrings[i] = 'parameters[' + i + ']';\n" -@" \n" -@" object.__apply__ = this;\n" -@" var result = eval('object.__apply__(' + \n" -@" parameterStrings[i].join(', ') + ')');\n" -@" object.__apply__ = null;\n" -@" \n" -@" return result;\n" -@" }\n" -@"}\n" -@"String.prototype.extend({\n" -@" stripTags: function() {\n" -@" return this.replace(/<\/?[^>]+>/gi, '');\n" -@" },\n" -@" escapeHTML: function() {\n" -@" var div = document.createElement('div');\n" -@" var text = document.createTextNode(this);\n" -@" div.appendChild(text);\n" -@" return div.innerHTML;\n" -@" },\n" -@" unescapeHTML: function() {\n" -@" var div = document.createElement('div');\n" -@" div.innerHTML = this.stripTags();\n" -@" return div.childNodes[0].nodeValue;\n" -@" }\n" -@"});\n" -@"var Ajax = {\n" -@" getTransport: function() {\n" -@" return Try.these(\n" -@" function() {return new ActiveXObject('Msxml2.XMLHTTP')},\n" -@" function() {return new ActiveXObject('Microsoft.XMLHTTP')},\n" -@" function() {return new XMLHttpRequest()}\n" -@" ) || false;\n" -@" }\n" -@"}\n" -@"Ajax.Base = function() {};\n" -@"Ajax.Base.prototype = {\n" -@" setOptions: function(options) {\n" -@" this.options = {\n" -@" method: 'post',\n" -@" asynchronous: true,\n" -@" parameters: ''\n" -@" }.extend(options || {});\n" -@" },\n" -@" responseIsSuccess: function() {\n" -@" return this.transport.status == undefined\n" -@" || this.transport.status == 0 \n" -@" || (this.transport.status >= 200 && this.transport.status < 300);\n" -@" },\n" -@" responseIsFailure: function() {\n" -@" return !this.responseIsSuccess();\n" -@" }\n" -@"}\n" -@"Ajax.Request = Class.create();\n" -@"Ajax.Request.Events = \n" -@" ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];\n" -@"Ajax.Request.prototype = (new Ajax.Base()).extend({\n" -@" initialize: function(url, options) {\n" -@" this.transport = Ajax.getTransport();\n" -@" this.setOptions(options);\n" -@" this.request(url);\n" -@" },\n" -@" request: function(url) {\n" -@" var parameters = this.options.parameters || '';\n" -@" if (parameters.length > 0) parameters += '&_=';\n" -@" try {\n" -@" if (this.options.method == 'get')\n" -@" url += '?' + parameters;\n" -@" this.transport.open(this.options.method, url,\n" -@" this.options.asynchronous);\n" -@" if (this.options.asynchronous) {\n" -@" this.transport.onreadystatechange = this.onStateChange.bind(this);\n" -@" setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);\n" -@" }\n" -@" this.setRequestHeaders();\n" -@" var body = this.options.postBody ? this.options.postBody : parameters;\n" -@" this.transport.send(this.options.method == 'post' ? body : null);\n" -@" } catch (e) {\n" -@" }\n" -@" },\n" -@" setRequestHeaders: function() {\n" -@" var requestHeaders = \n" -@" ['X-Requested-With', 'XMLHttpRequest',\n" -@" 'X-Prototype-Version', Prototype.Version];\n" -@" if (this.options.method == 'post') {\n" -@" requestHeaders.push('Content-type', \n" -@" 'application/x-www-form-urlencoded');\n" -@" /* Force \"Connection: close\" for Mozilla browsers to work around\n" -@" * a bug where XMLHttpReqeuest sends an incorrect Content-length\n" -@" * header. See Mozilla Bugzilla #246651. \n" -@" */\n" -@" if (this.transport.overrideMimeType)\n" -@" requestHeaders.push('Connection', 'close');\n" -@" }\n" -@" if (this.options.requestHeaders)\n" -@" requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);\n" -@" for (var i = 0; i < requestHeaders.length; i += 2)\n" -@" this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);\n" -@" },\n" -@" onStateChange: function() {\n" -@" var readyState = this.transport.readyState;\n" -@" if (readyState != 1)\n" -@" this.respondToReadyState(this.transport.readyState);\n" -@" },\n" -@" respondToReadyState: function(readyState) {\n" -@" var event = Ajax.Request.Events[readyState];\n" -@" if (event == 'Complete')\n" -@" (this.options['on' + this.transport.status]\n" -@" || this.options['on' + this.responseIsSuccess() ? 'Success' : 'Failure']\n" -@" || Prototype.emptyFunction)(this.transport);\n" -@" (this.options['on' + event] || Prototype.emptyFunction)(this.transport);\n" -@" /* Avoid memory leak in MSIE: clean up the oncomplete event handler */\n" -@" if (event == 'Complete')\n" -@" this.transport.onreadystatechange = Prototype.emptyFunction;\n" -@" }\n" -@"});\n" -@"Ajax.Updater = Class.create();\n" -@"Ajax.Updater.ScriptFragment = '(?:)((\n|.)*?)(?:<\/script>)';\n" -@"Ajax.Updater.prototype.extend(Ajax.Request.prototype).extend({\n" -@" initialize: function(container, url, options) {\n" -@" this.containers = {\n" -@" success: container.success ? $(container.success) : $(container),\n" -@" failure: container.failure ? $(container.failure) :\n" -@" (container.success ? null : $(container))\n" -@" }\n" -@" this.transport = Ajax.getTransport();\n" -@" this.setOptions(options);\n" -@" var onComplete = this.options.onComplete || Prototype.emptyFunction;\n" -@" this.options.onComplete = (function() {\n" -@" this.updateContent();\n" -@" onComplete(this.transport);\n" -@" }).bind(this);\n" -@" this.request(url);\n" -@" },\n" -@" updateContent: function() {\n" -@" var receiver = this.responseIsSuccess() ?\n" -@" this.containers.success : this.containers.failure;\n" -@" var match = new RegExp(Ajax.Updater.ScriptFragment, 'img');\n" -@" var response = this.transport.responseText.replace(match, '');\n" -@" var scripts = this.transport.responseText.match(match);\n" -@" if (receiver) {\n" -@" if (this.options.insertion) {\n" -@" new this.options.insertion(receiver, response);\n" -@" } else {\n" -@" receiver.innerHTML = response;\n" -@" }\n" -@" }\n" -@" if (this.responseIsSuccess()) {\n" -@" if (this.onComplete)\n" -@" setTimeout((function() {this.onComplete(\n" -@" this.transport)}).bind(this), 10);\n" -@" }\n" -@" if (this.options.evalScripts && scripts) {\n" -@" match = new RegExp(Ajax.Updater.ScriptFragment, 'im');\n" -@" setTimeout((function() {\n" -@" for (var i = 0; i < scripts.length; i++)\n" -@" eval(scripts[i].match(match)[1]);\n" -@" }).bind(this), 10);\n" -@" }\n" -@" }\n" -@"});\n" -@"Ajax.PeriodicalUpdater = Class.create();\n" -@"Ajax.PeriodicalUpdater.prototype = (new Ajax.Base()).extend({\n" -@" initialize: function(container, url, options) {\n" -@" this.setOptions(options);\n" -@" this.onComplete = this.options.onComplete;\n" -@" this.frequency = (this.options.frequency || 2);\n" -@" this.decay = 1;\n" -@" this.updater = {};\n" -@" this.container = container;\n" -@" this.url = url;\n" -@" this.start();\n" -@" },\n" -@" start: function() {\n" -@" this.options.onComplete = this.updateComplete.bind(this);\n" -@" this.onTimerEvent();\n" -@" },\n" -@" stop: function() {\n" -@" this.updater.onComplete = undefined;\n" -@" clearTimeout(this.timer);\n" -@" (this.onComplete || Ajax.emptyFunction).apply(this, arguments);\n" -@" },\n" -@" updateComplete: function(request) {\n" -@" if (this.options.decay) {\n" -@" this.decay = (request.responseText == this.lastText ? \n" -@" this.decay * this.options.decay : 1);\n" -@" this.lastText = request.responseText;\n" -@" }\n" -@" this.timer = setTimeout(this.onTimerEvent.bind(this), \n" -@" this.decay * this.frequency * 1000);\n" -@" },\n" -@" onTimerEvent: function() {\n" -@" this.updater = new Ajax.Updater(this.container, this.url, this.options);\n" -@" }\n" -@"});\n" -@"document.getElementsByClassName = function(className) {\n" -@" var children = document.getElementsByTagName('*') || document.all;\n" -@" var elements = new Array();\n" -@" \n" -@" for (var i = 0; i < children.length; i++) {\n" -@" var child = children[i];\n" -@" var classNames = child.className.split(' ');\n" -@" for (var j = 0; j < classNames.length; j++) {\n" -@" if (classNames[j] == className) {\n" -@" elements.push(child);\n" -@" break;\n" -@" }\n" -@" }\n" -@" }\n" -@" \n" -@" return elements;\n" -@"}\n" -@"/*--------------------------------------------------------------------------*/\n" -@"if (!window.Element) {\n" -@" var Element = new Object();\n" -@"}\n" -@"Object.extend(Element, {\n" -@" toggle: function() {\n" -@" for (var i = 0; i < arguments.length; i++) {\n" -@" var element = $(arguments[i]);\n" -@" element.style.display = \n" -@" (element.style.display == 'none' ? '' : 'none');\n" -@" }\n" -@" },\n" -@" hide: function() {\n" -@" for (var i = 0; i < arguments.length; i++) {\n" -@" var element = $(arguments[i]);\n" -@" element.style.display = 'none';\n" -@" }\n" -@" },\n" -@" show: function() {\n" -@" for (var i = 0; i < arguments.length; i++) {\n" -@" var element = $(arguments[i]);\n" -@" element.style.display = '';\n" -@" }\n" -@" },\n" -@" remove: function(element) {\n" -@" element = $(element);\n" -@" element.parentNode.removeChild(element);\n" -@" },\n" -@" \n" -@" getHeight: function(element) {\n" -@" element = $(element);\n" -@" return element.offsetHeight; \n" -@" },\n" -@" hasClassName: function(element, className) {\n" -@" element = $(element);\n" -@" if (!element)\n" -@" return;\n" -@" var a = element.className.split(' ');\n" -@" for (var i = 0; i < a.length; i++) {\n" -@" if (a[i] == className)\n" -@" return true;\n" -@" }\n" -@" return false;\n" -@" },\n" -@" addClassName: function(element, className) {\n" -@" element = $(element);\n" -@" Element.removeClassName(element, className);\n" -@" element.className += ' ' + className;\n" -@" },\n" -@" removeClassName: function(element, className) {\n" -@" element = $(element);\n" -@" if (!element)\n" -@" return;\n" -@" var newClassName = '';\n" -@" var a = element.className.split(' ');\n" -@" for (var i = 0; i < a.length; i++) {\n" -@" if (a[i] != className) {\n" -@" if (i > 0)\n" -@" newClassName += ' ';\n" -@" newClassName += a[i];\n" -@" }\n" -@" }\n" -@" element.className = newClassName;\n" -@" },\n" -@" \n" -@" // removes whitespace-only text node children\n" -@" cleanWhitespace: function(element) {\n" -@" var element = $(element);\n" -@" for (var i = 0; i < element.childNodes.length; i++) {\n" -@" var node = element.childNodes[i];\n" -@" if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) \n" -@" Element.remove(node);\n" -@" }\n" -@" }\n" -@"});\n" -@"var Toggle = new Object();\n" -@"Toggle.display = Element.toggle;\n" -@"/*--------------------------------------------------------------------------*/\n" -@"Abstract.Insertion = function(adjacency) {\n" -@" this.adjacency = adjacency;\n" -@"}\n" -@"Abstract.Insertion.prototype = {\n" -@" initialize: function(element, content) {\n" -@" this.element = $(element);\n" -@" this.content = content;\n" -@" \n" -@" if (this.adjacency && this.element.insertAdjacentHTML) {\n" -@" this.element.insertAdjacentHTML(this.adjacency, this.content);\n" -@" } else {\n" -@" this.range = this.element.ownerDocument.createRange();\n" -@" if (this.initializeRange) this.initializeRange();\n" -@" this.fragment = this.range.createContextualFragment(this.content);\n" -@" this.insertContent();\n" -@" }\n" -@" }\n" -@"}\n" -@"var Insertion = new Object();\n" -@"Insertion.Before = Class.create();\n" -@"Insertion.Before.prototype = (new Abstract.Insertion('beforeBegin')).extend({\n" -@" initializeRange: function() {\n" -@" this.range.setStartBefore(this.element);\n" -@" },\n" -@" \n" -@" insertContent: function() {\n" -@" this.element.parentNode.insertBefore(this.fragment, this.element);\n" -@" }\n" -@"});\n" -@"Insertion.Top = Class.create();\n" -@"Insertion.Top.prototype = (new Abstract.Insertion('afterBegin')).extend({\n" -@" initializeRange: function() {\n" -@" this.range.selectNodeContents(this.element);\n" -@" this.range.collapse(true);\n" -@" },\n" -@" \n" -@" insertContent: function() { \n" -@" this.element.insertBefore(this.fragment, this.element.firstChild);\n" -@" }\n" -@"});\n" -@"Insertion.Bottom = Class.create();\n" -@"Insertion.Bottom.prototype = (new Abstract.Insertion('beforeEnd')).extend({\n" -@" initializeRange: function() {\n" -@" this.range.selectNodeContents(this.element);\n" -@" this.range.collapse(this.element);\n" -@" },\n" -@" \n" -@" insertContent: function() {\n" -@" this.element.appendChild(this.fragment);\n" -@" }\n" -@"});\n" -@"Insertion.After = Class.create();\n" -@"Insertion.After.prototype = (new Abstract.Insertion('afterEnd')).extend({\n" -@" initializeRange: function() {\n" -@" this.range.setStartAfter(this.element);\n" -@" },\n" -@" \n" -@" insertContent: function() {\n" -@" this.element.parentNode.insertBefore(this.fragment, \n" -@" this.element.nextSibling);\n" -@" }\n" -@"});\n" -@"var Field = {\n" -@" clear: function() {\n" -@" for (var i = 0; i < arguments.length; i++)\n" -@" $(arguments[i]).value = '';\n" -@" },\n" -@" focus: function(element) {\n" -@" $(element).focus();\n" -@" },\n" -@" \n" -@" present: function() {\n" -@" for (var i = 0; i < arguments.length; i++)\n" -@" if ($(arguments[i]).value == '') return false;\n" -@" return true;\n" -@" },\n" -@" \n" -@" select: function(element) {\n" -@" $(element).select();\n" -@" },\n" -@" \n" -@" activate: function(element) {\n" -@" $(element).focus();\n" -@" $(element).select();\n" -@" }\n" -@"}\n" -@"/*--------------------------------------------------------------------------*/\n" -@"var Form = {\n" -@" serialize: function(form) {\n" -@" var elements = Form.getElements($(form));\n" -@" var queryComponents = new Array();\n" -@" \n" -@" for (var i = 0; i < elements.length; i++) {\n" -@" var queryComponent = Form.Element.serialize(elements[i]);\n" -@" if (queryComponent)\n" -@" queryComponents.push(queryComponent);\n" -@" }\n" -@" \n" -@" return queryComponents.join('&');\n" -@" },\n" -@" \n" -@" getElements: function(form) {\n" -@" var form = $(form);\n" -@" var elements = new Array();\n" -@" for (tagName in Form.Element.Serializers) {\n" -@" var tagElements = form.getElementsByTagName(tagName);\n" -@" for (var j = 0; j < tagElements.length; j++)\n" -@" elements.push(tagElements[j]);\n" -@" }\n" -@" return elements;\n" -@" },\n" -@" \n" -@" getInputs: function(form, typeName, name) {\n" -@" var form = $(form);\n" -@" var inputs = form.getElementsByTagName('input');\n" -@" \n" -@" if (!typeName && !name)\n" -@" return inputs;\n" -@" \n" -@" var matchingInputs = new Array();\n" -@" for (var i = 0; i < inputs.length; i++) {\n" -@" var input = inputs[i];\n" -@" if ((typeName && input.type != typeName) ||\n" -@" (name && input.name != name)) \n" -@" continue;\n" -@" matchingInputs.push(input);\n" -@" }\n" -@" return matchingInputs;\n" -@" },\n" -@" disable: function(form) {\n" -@" var elements = Form.getElements(form);\n" -@" for (var i = 0; i < elements.length; i++) {\n" -@" var element = elements[i];\n" -@" element.blur();\n" -@" element.disabled = 'true';\n" -@" }\n" -@" },\n" -@" enable: function(form) {\n" -@" var elements = Form.getElements(form);\n" -@" for (var i = 0; i < elements.length; i++) {\n" -@" var element = elements[i];\n" -@" element.disabled = '';\n" -@" }\n" -@" },\n" -@" focusFirstElement: function(form) {\n" -@" var form = $(form);\n" -@" var elements = Form.getElements(form);\n" -@" for (var i = 0; i < elements.length; i++) {\n" -@" var element = elements[i];\n" -@" if (element.type != 'hidden' && !element.disabled) {\n" -@" Field.activate(element);\n" -@" break;\n" -@" }\n" -@" }\n" -@" },\n" -@" reset: function(form) {\n" -@" $(form).reset();\n" -@" }\n" -@"}\n" -@"Form.Element = {\n" -@" serialize: function(element) {\n" -@" var element = $(element);\n" -@" var method = element.tagName.toLowerCase();\n" -@" var parameter = Form.Element.Serializers[method](element);\n" -@" \n" -@" if (parameter)\n" -@" return encodeURIComponent(parameter[0]) + '=' + \n" -@" encodeURIComponent(parameter[1]); \n" -@" },\n" -@" \n" -@" getValue: function(element) {\n" -@" var element = $(element);\n" -@" var method = element.tagName.toLowerCase();\n" -@" var parameter = Form.Element.Serializers[method](element);\n" -@" \n" -@" if (parameter) \n" -@" return parameter[1];\n" -@" }\n" -@"}\n" -@"Form.Element.Serializers = {\n" -@" input: function(element) {\n" -@" switch (element.type.toLowerCase()) {\n" -@" case 'submit':\n" -@" case 'hidden':\n" -@" case 'password':\n" -@" case 'text':\n" -@" return Form.Element.Serializers.textarea(element);\n" -@" case 'checkbox': \n" -@" case 'radio':\n" -@" return Form.Element.Serializers.inputSelector(element);\n" -@" }\n" -@" return false;\n" -@" },\n" -@" inputSelector: function(element) {\n" -@" if (element.checked)\n" -@" return [element.name, element.value];\n" -@" },\n" -@" textarea: function(element) {\n" -@" return [element.name, element.value];\n" -@" },\n" -@" select: function(element) {\n" -@" var value = '';\n" -@" if (element.type == 'select-one') {\n" -@" var index = element.selectedIndex;\n" -@" if (index >= 0)\n" -@" value = element.options[index].value || element.options[index].text;\n" -@" } else {\n" -@" value = new Array();\n" -@" for (var i = 0; i < element.length; i++) {\n" -@" var opt = element.options[i];\n" -@" if (opt.selected)\n" -@" value.push(opt.value || opt.text);\n" -@" }\n" -@" }\n" -@" return [element.name, value];\n" -@" }\n" -@"}\n" -@"/*--------------------------------------------------------------------------*/\n" -@"var $F = Form.Element.getValue;\n" -@"/*--------------------------------------------------------------------------*/\n" -@"Abstract.TimedObserver = function() {}\n" -@"Abstract.TimedObserver.prototype = {\n" -@" initialize: function(element, frequency, callback) {\n" -@" this.frequency = frequency;\n" -@" this.element = $(element);\n" -@" this.callback = callback;\n" -@" \n" -@" this.lastValue = this.getValue();\n" -@" this.registerCallback();\n" -@" },\n" -@" \n" -@" registerCallback: function() {\n" -@" setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);\n" -@" },\n" -@" \n" -@" onTimerEvent: function() {\n" -@" var value = this.getValue();\n" -@" if (this.lastValue != value) {\n" -@" this.callback(this.element, value);\n" -@" this.lastValue = value;\n" -@" }\n" -@" }\n" -@"}\n" -@"Form.Element.Observer = Class.create();\n" -@"Form.Element.Observer.prototype = (new Abstract.TimedObserver()).extend({\n" -@" getValue: function() {\n" -@" return Form.Element.getValue(this.element);\n" -@" }\n" -@"});\n" -@"Form.Observer = Class.create();\n" -@"Form.Observer.prototype = (new Abstract.TimedObserver()).extend({\n" -@" getValue: function() {\n" -@" return Form.serialize(this.element);\n" -@" }\n" -@"});\n" -@"/*--------------------------------------------------------------------------*/\n" -@"Abstract.EventObserver = function() {}\n" -@"Abstract.EventObserver.prototype = {\n" -@" initialize: function(element, callback) {\n" -@" this.element = $(element);\n" -@" this.callback = callback;\n" -@" \n" -@" this.lastValue = this.getValue();\n" -@" if (this.element.tagName.toLowerCase() == 'form')\n" -@" this.registerFormCallbacks();\n" -@" else\n" -@" this.registerCallback(this.element);\n" -@" },\n" -@" \n" -@" onElementEvent: function() {\n" -@" var value = this.getValue();\n" -@" if (this.lastValue != value) {\n" -@" this.callback(this.element, value);\n" -@" this.lastValue = value;\n" -@" }\n" -@" },\n" -@" \n" -@" registerFormCallbacks: function() {\n" -@" var elements = Form.getElements(this.element);\n" -@" for (var i = 0; i < elements.length; i++)\n" -@" this.registerCallback(elements[i]);\n" -@" },\n" -@" \n" -@" registerCallback: function(element) {\n" -@" if (element.type) {\n" -@" switch (element.type.toLowerCase()) {\n" -@" case 'checkbox': \n" -@" case 'radio':\n" -@" element.target = this;\n" -@" element.prev_onclick = element.onclick || Prototype.emptyFunction;\n" -@" element.onclick = function() {\n" -@" this.prev_onclick(); \n" -@" this.target.onElementEvent();\n" -@" }\n" -@" break;\n" -@" case 'password':\n" -@" case 'text':\n" -@" case 'textarea':\n" -@" case 'select-one':\n" -@" case 'select-multiple':\n" -@" element.target = this;\n" -@" element.prev_onchange = element.onchange || Prototype.emptyFunction;\n" -@" element.onchange = function() {\n" -@" this.prev_onchange(); \n" -@" this.target.onElementEvent();\n" -@" }\n" -@" break;\n" -@" }\n" -@" } \n" -@" }\n" -@"}\n" -@"Form.Element.EventObserver = Class.create();\n" -@"Form.Element.EventObserver.prototype = (new Abstract.EventObserver()).extend({\n" -@" getValue: function() {\n" -@" return Form.Element.getValue(this.element);\n" -@" }\n" -@"});\n" -@"Form.EventObserver = Class.create();\n" -@"Form.EventObserver.prototype = (new Abstract.EventObserver()).extend({\n" -@" getValue: function() {\n" -@" return Form.serialize(this.element);\n" -@" }\n" -@"});\n" -@"if (!window.Event) {\n" -@" var Event = new Object();\n" -@"}\n" -@"Object.extend(Event, {\n" -@" KEY_BACKSPACE: 8,\n" -@" KEY_TAB: 9,\n" -@" KEY_RETURN: 13,\n" -@" KEY_ESC: 27,\n" -@" KEY_LEFT: 37,\n" -@" KEY_UP: 38,\n" -@" KEY_RIGHT: 39,\n" -@" KEY_DOWN: 40,\n" -@" KEY_DELETE: 46,\n" -@" element: function(event) {\n" -@" return event.target || event.srcElement;\n" -@" },\n" -@" isLeftClick: function(event) {\n" -@" return (((event.which) && (event.which == 1)) ||\n" -@" ((event.button) && (event.button == 1)));\n" -@" },\n" -@" pointerX: function(event) {\n" -@" return event.pageX || (event.clientX + \n" -@" (document.documentElement.scrollLeft || document.body.scrollLeft));\n" -@" },\n" -@" pointerY: function(event) {\n" -@" return event.pageY || (event.clientY + \n" -@" (document.documentElement.scrollTop || document.body.scrollTop));\n" -@" },\n" -@" stop: function(event) {\n" -@" if (event.preventDefault) { \n" -@" event.preventDefault(); \n" -@" event.stopPropagation(); \n" -@" } else {\n" -@" event.returnValue = false;\n" -@" }\n" -@" },\n" -@" // find the first node with the given tagName, starting from the\n" -@" // node the event was triggered on; traverses the DOM upwards\n" -@" findElement: function(event, tagName) {\n" -@" var element = Event.element(event);\n" -@" while (element.parentNode && (!element.tagName ||\n" -@" (element.tagName.toUpperCase() != tagName.toUpperCase())))\n" -@" element = element.parentNode;\n" -@" return element;\n" -@" },\n" -@" observers: false,\n" -@" \n" -@" _observeAndCache: function(element, name, observer, useCapture) {\n" -@" if (!this.observers) this.observers = [];\n" -@" if (element.addEventListener) {\n" -@" this.observers.push([element, name, observer, useCapture]);\n" -@" element.addEventListener(name, observer, useCapture);\n" -@" } else if (element.attachEvent) {\n" -@" this.observers.push([element, name, observer, useCapture]);\n" -@" element.attachEvent('on' + name, observer);\n" -@" }\n" -@" },\n" -@" \n" -@" unloadCache: function() {\n" -@" if (!Event.observers) return;\n" -@" for (var i = 0; i < Event.observers.length; i++) {\n" -@" Event.stopObserving.apply(this, Event.observers[i]);\n" -@" Event.observers[i][0] = null;\n" -@" }\n" -@" Event.observers = false;\n" -@" },\n" -@" observe: function(element, name, observer, useCapture) {\n" -@" var element = $(element);\n" -@" useCapture = useCapture || false;\n" -@" \n" -@" if (name == 'keypress' &&\n" -@" ((navigator.appVersion.indexOf('AppleWebKit') > 0) \n" -@" || element.attachEvent))\n" -@" name = 'keydown';\n" -@" \n" -@" this._observeAndCache(element, name, observer, useCapture);\n" -@" },\n" -@" stopObserving: function(element, name, observer, useCapture) {\n" -@" var element = $(element);\n" -@" useCapture = useCapture || false;\n" -@" \n" -@" if (name == 'keypress' &&\n" -@" ((navigator.appVersion.indexOf('AppleWebKit') > 0) \n" -@" || element.detachEvent))\n" -@" name = 'keydown';\n" -@" \n" -@" if (element.removeEventListener) {\n" -@" element.removeEventListener(name, observer, useCapture);\n" -@" } else if (element.detachEvent) {\n" -@" element.detachEvent('on' + name, observer);\n" -@" }\n" -@" }\n" -@"});\n" -@"/* prevent memory leaks in IE */\n" -@"Event.observe(window, 'unload', Event.unloadCache, false);\n" -@"var Position = {\n" -@" // set to true if needed, warning: firefox performance problems\n" -@" // NOT neeeded for page scrolling, only if draggable contained in\n" -@" // scrollable elements\n" -@" includeScrollOffsets: false, \n" -@" // must be called before calling withinIncludingScrolloffset, every time the\n" -@" // page is scrolled\n" -@" prepare: function() {\n" -@" this.deltaX = window.pageXOffset \n" -@" || document.documentElement.scrollLeft \n" -@" || document.body.scrollLeft \n" -@" || 0;\n" -@" this.deltaY = window.pageYOffset \n" -@" || document.documentElement.scrollTop \n" -@" || document.body.scrollTop \n" -@" || 0;\n" -@" },\n" -@" realOffset: function(element) {\n" -@" var valueT = 0, valueL = 0;\n" -@" do {\n" -@" valueT += element.scrollTop || 0;\n" -@" valueL += element.scrollLeft || 0; \n" -@" element = element.parentNode;\n" -@" } while (element);\n" -@" return [valueL, valueT];\n" -@" },\n" -@" cumulativeOffset: function(element) {\n" -@" var valueT = 0, valueL = 0;\n" -@" do {\n" -@" valueT += element.offsetTop || 0;\n" -@" valueL += element.offsetLeft || 0;\n" -@" element = element.offsetParent;\n" -@" } while (element);\n" -@" return [valueL, valueT];\n" -@" },\n" -@" // caches x/y coordinate pair to use with overlap\n" -@" within: function(element, x, y) {\n" -@" if (this.includeScrollOffsets)\n" -@" return this.withinIncludingScrolloffsets(element, x, y);\n" -@" this.xcomp = x;\n" -@" this.ycomp = y;\n" -@" this.offset = this.cumulativeOffset(element);\n" -@" return (y >= this.offset[1] &&\n" -@" y < this.offset[1] + element.offsetHeight &&\n" -@" x >= this.offset[0] && \n" -@" x < this.offset[0] + element.offsetWidth);\n" -@" },\n" -@" withinIncludingScrolloffsets: function(element, x, y) {\n" -@" var offsetcache = this.realOffset(element);\n" -@" this.xcomp = x + offsetcache[0] - this.deltaX;\n" -@" this.ycomp = y + offsetcache[1] - this.deltaY;\n" -@" this.offset = this.cumulativeOffset(element);\n" -@" return (this.ycomp >= this.offset[1] &&\n" -@" this.ycomp < this.offset[1] + element.offsetHeight &&\n" -@" this.xcomp >= this.offset[0] && \n" -@" this.xcomp < this.offset[0] + element.offsetWidth);\n" -@" },\n" -@" // within must be called directly before\n" -@" overlap: function(mode, element) { \n" -@" if (!mode) return 0; \n" -@" if (mode == 'vertical') \n" -@" return ((this.offset[1] + element.offsetHeight) - this.ycomp) / \n" -@" element.offsetHeight;\n" -@" if (mode == 'horizontal')\n" -@" return ((this.offset[0] + element.offsetWidth) - this.xcomp) / \n" -@" element.offsetWidth;\n" -@" },\n" -@" clone: function(source, target) {\n" -@" source = $(source);\n" -@" target = $(target);\n" -@" target.style.position = 'absolute';\n" -@" var offsets = this.cumulativeOffset(source);\n" -@" target.style.top = offsets[1] + 'px';\n" -@" target.style.left = offsets[0] + 'px';\n" -@" target.style.width = source.offsetWidth + 'px';\n" -@" target.style.height = source.offsetHeight + 'px';\n" -@" }\n" -@"}\n" ============================================================ --- sope-appserver/WEPrototype/WEPrototypeScript.m 5558c1314f2eaf237ce14306a2ec1cc88d51f661 +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WEPrototypeScript.h" -#include "common.h" - -@implementation WEPrototypeScript - -static NSString *WEPrototypeScriptKey = @"WEPrototypeScriptKey"; - -/* generating response */ - -+ (BOOL)wasDeliveredInContext:(WOContext *)_ctx { - return [[_ctx objectForKey:WEPrototypeScriptKey] boolValue]; -} - -+ (void)markDeliveredInContext:(WOContext *)_ctx { - [_ctx setObject:@"YES" forKey:WEPrototypeScriptKey]; -} - -+ (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { - NSString *url; - - if ([_ctx isRenderingDisabled]) return; - if ([self wasDeliveredInContext:_ctx]) return; - - url = [_ctx directActionURLForActionNamed: - @"WEPrototypeScriptAction/default.js" - queryDictionary:nil]; - - [_response appendContentString:@""]; - - [self markDeliveredInContext:_ctx]; -} - -- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { - [[self class] appendToResponse:_response inContext:_ctx]; -} - -@end /* WEPrototypeScript */ ============================================================ --- sope-appserver/WEPrototype/WEPrototypeScriptAction.m 1b33ae31bc90a9436ad7a96098ae966bc6e323b2 +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#import - -@interface WEPrototypeScriptAction : WODirectAction -@end - -#include "common.h" - -@implementation WEPrototypeScriptAction - -static NSString *etag = nil; -static NSString *script = -#include "WEPrototypeScript.jsm" - ; - -+ (void)initialize { - if (etag == nil) { - etag = [[NSString alloc] initWithFormat:@"\"sope/%i.%i-wep+%03i\"", - SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION, - WEP_SUBMINOR_VERSION]; - } -} - -- (id)defaultAction { - WOResponse *r; - NSString *s; - - r = [[self context] response]; - [r setHeader:@"application/x-javascript" forKey:@"content-type"]; - [r setHeader:etag forKey:@"etag"]; - - /* check preconditions */ - - if ((s = [[[self context] request] headerForKey:@"if-none-match"]) != nil) { - if ([s rangeOfString:etag].length > 0) { - /* client already has the proper entity */ - [r setStatus:304 /* Not Modified */]; - return r; - } - } - - /* send script */ - - [r setStatus:200 /* OK */]; - [r appendContentString:script]; - return r; -} - -@end /* WEPrototypeScriptAction */ ============================================================ --- sope-appserver/WEPrototype/bundle-info.plist d0911e29684afaae94c747fb68738dbb1043628b +++ /dev/null @@ -1,23 +0,0 @@ -{ - requires = { - bundleManagerVersion = 1; - - classes = ( - { name = NSObject; } - ); - }; - - provides = { - WOxElemBuilder = ( - { name = "WEPrototypeElemBuilder"; }, - ); - - WODynamicElements = ( - { name = "WELiveLink"; }, - ); - - classes = ( - { name = "WEPrototypeElemBuilder"; }, - ); - }; -} ============================================================ --- sope-appserver/WEPrototype/common.h f40450d68207c62c833ba5ed68ea44eea0664c25 +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2005 Helge Hess - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WEPrototype_common_H__ -#define __WEPrototype_common_H__ - -#import - -#include -#include - -#if NeXT_Foundation_LIBRARY || APPLE_Foundation_LIBRARY -# include -#endif - -static inline id WEPExtGetProperty(NSDictionary *_set, NSString *_name) { - id propValue = [_set objectForKey:_name]; - - if (propValue != nil) { - propValue = [propValue retain]; - [(NSMutableDictionary *)_set removeObjectForKey:_name]; - } - return propValue; -} - -#endif /* __WEPrototype_common_H__ */ ============================================================ --- sope-appserver/WEPrototype/doc/GNUmakefile 5f5df5a7451dde1a4b0522898cfcfaf6694860a1 +++ /dev/null @@ -1,18 +0,0 @@ -# makefile to generate manpages from .api files - -SOPE_ROOT=../../.. - -include $(SOPE_ROOT)/config.make -include $(SOPE_ROOT)/Version -include ../Version - -API2MAN = ../../NGObjWeb/woapi2man.py -SECTION = 3 - -all :: regenerate - -regenerate :: - for apifile in ../*.api; do \ - OUTFILE="`basename $$apifile | sed s/\\.api/.3/g`"; \ - $(API2MAN) $$apifile $$SECTION $(MAJOR_VERSION) $(MINOR_VERSION) $(SUBMINOR_VERSION) >$$OUTFILE; \ - done ============================================================ --- sope-appserver/WEPrototype/doc/WEPrototypeScript.3 58c486a8ee1d59c550f2dbee5a16dce90886fe5d +++ /dev/null @@ -1,34 +0,0 @@ -.TH WEPrototypeScript 3 "September 2005" "SOPE" "SOPE Dynamic Element Reference" -.\" DO NOT EDIT: this file got autogenerated using woapi2man from: -.\" ../WEPrototypeScript.api -.\" -.\" Copyright (C) 2005 SKYRIX Software AG. All rights reserved. -.\" ==================================================================== -.\" -.\" Copyright (C) 2005 SKYRIX Software AG. All rights reserved. -.\" -.\" Check the COPYING file for further information. -.\" -.\" Created with the help of: -.\" http://www.schweikhardt.net/man_page_howto.html -.\" - -.SH NAME -WEPrototypeScript - -.SH SYNOPSIS -.B WEPrototypeScript -{} - -.SH BINDINGS - -.SH BUGS -SOPE related bugs are collected in the OpenGroupware.org Bugzilla: - http://bugzilla.opengroupware.org/ - -.SH AUTHOR -The SOPE community . - -.SH SEE ALSO -.BR sope-ngobjweb-defaults - ============================================================ --- sope-appserver/WEPrototype/fhs.make 507199c2a35ebf1a90b9cc79b44d44ebbcd0743b +++ /dev/null @@ -1,64 +0,0 @@ -# postprocessing - -# FHS support (this is a hack and is going to be done by gstep-make!) - -ifneq ($(FHS_INSTALL_ROOT),) - -FHS_INCLUDE_DIR=$(FHS_INSTALL_ROOT)/include/ -FHS_BIN_DIR=$(FHS_INSTALL_ROOT)/bin/ -FHS_MAN_DIR=$(FHS_INSTALL_ROOT)/man - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib64/ -else -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ -endif -FHS_WOx_DIR=$(FHS_LIB_DIR)sope-$(MAJOR_VERSION).$(MINOR_VERSION)/wox-builders/ - -NONFHS_LIBDIR="$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)/" -NONFHS_LIBNAME="$(LIBRARY_NAME)$(LIBRARY_NAME_SUFFIX)$(SHARED_LIBEXT)" - - -fhs-header-dirs :: - $(MKDIRS) $(FHS_INCLUDE_DIR)$(libWEPrototype_HEADER_FILES_INSTALL_DIR) - -fhs-wox-dirs :: - $(MKDIRS) $(FHS_WOx_DIR) - -fhs-man-dirs :: - $(MKDIRS) $(FHS_MAN_DIR) - -ifeq ($(libWEPrototype_HEADER_FILES),) -move-headers-to-fhs :: -else -move-headers-to-fhs :: fhs-header-dirs - @echo "moving headers to $(FHS_INCLUDE_DIR) .." - mv $(GNUSTEP_HEADERS)$(libWEPrototype_HEADER_FILES_INSTALL_DIR)/*.h \ - $(FHS_INCLUDE_DIR)$(libWEPrototype_HEADER_FILES_INSTALL_DIR)/ -endif - -move-libs-to-fhs :: - @echo "moving libs to $(FHS_LIB_DIR) .." - mv $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ - -move-bundles-to-fhs :: fhs-wox-dirs - @echo "moving bundles $(BUNDLE_INSTALL_DIR) to $(FHS_WOx_DIR) .." - for i in $(BUNDLE_NAME); do \ - j="$(FHS_WOx_DIR)/$${i}$(BUNDLE_EXTENSION)"; \ - if test -d $$j; then rm -r $$j; fi; \ - mv "$(BUNDLE_INSTALL_DIR)/$${i}$(BUNDLE_EXTENSION)" $$j; \ - done - -move-to-fhs :: move-headers-to-fhs move-libs-to-fhs move-bundles-to-fhs - -install-fhs-manpages :: fhs-man-dirs - @echo "installing manpages in $(FHS_MAN_DIR) ..." - for i in $(FHS_MANPAGES); do \ - msection="$(FHS_MAN_DIR)/man`echo -n $$i | tail -c 1`"; \ - $(MKDIRS) $$msection; \ - $(INSTALL_DATA) $$i $$msection; \ - done - -after-install :: install-fhs-manpages move-to-fhs - -endif ============================================================ --- sope-appserver/WEPrototype/js2m.sh f9ba084db3ec1861f8a44cb3cc178acb7e697a75 +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -jsfile=$1 -mfile=$2 - -if [ "x${jsfile}" = "x" ]; then - echo "usage: $0 " - exit 1; -fi -if [ "x${mfile}" = "x" ]; then - echo "usage: $0 " - exit 1; -fi - -if [ ! -f $jsfile ]; then - echo "$0: file '${jsfile}' can't be found !" - exit 2; -fi - -echo "transforming ${jsfile} to ${mfile} .." - -IFS=" -" -replaceto='\\"' - -SEDCMD=sed -ECHOCMD=echo - -BACKPAT="s|\\\\|\\\\\\\\|g" - -$ECHOCMD >$mfile "/* automatically generated from ${jsfile}, do not edit ! */" -for i in `cat ${jsfile} | ${SEDCMD} "$BACKPAT" | ${SEDCMD} "s|\\"|$replaceto|g"`; do - $ECHOCMD -n >>$mfile "@\"" - $ECHOCMD -n >>$mfile "${i}" - $ECHOCMD >>$mfile "\\\n\"" -done ============================================================ --- sope-appserver/WEPrototype/prototype/AUTHORS 93674f7f0d6d45d54986700c7ca80bab7c8ae251 +++ /dev/null @@ -1,12 +0,0 @@ -Creator and maintainer - -* Sam Stephenson -- http://conio.net/ - -Contributors - -* Thomas Fuchs -- http://mir.aculo.us/ -* David Heinemeier Hansson -- http://www.loudthinking.com/ -* Matthew McCray -- http://www.mattmccray.com/ -* Michael Schuerig -- http://www.schuerig.de/michael/ -* Sean Treadway -- http://sean.treadway.info/ -* flash@vanklinkenbergsoftware.nl ============================================================ --- sope-appserver/WEPrototype/prototype/LICENSE ddb7eadeb35ab72b22548e002d516e8de9f86c6b +++ /dev/null @@ -1,16 +0,0 @@ -Copyright (c) 2005 Sam Stephenson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. ============================================================ --- sope-appserver/WEPrototype/prototype/README eb5581f1d6d3455977940e8ffe8847fd31cb066d +++ /dev/null @@ -1,64 +0,0 @@ -= Prototype -==== An object-oriented JavaScript framework - -(c) 2005 Sam Stephenson (mailto:sam@conio.net) - -Prototype is a JavaScript framework that aims to ease development of dynamic -web applications. Its development is driven heavily by the Ruby on Rails -framework, but it can be used in any environment. - -=== Targeted platforms - -Prototype currently targets the following platforms: - -* Microsoft Internet Explorer for Windows, version 6.0 and higher -* Mozilla Firefox 1.0/Mozilla 1.7 and higher -* Apple Safari 1.2 and higher - -== Using Prototype - -To use Prototype in your application, download the latest release from the -Prototype web site (http://prototype.conio.net/) and copy -dist/prototype.js to a suitable location. Then include it in your HTML -like so: - - - -=== Building Prototype from source - -prototype.js is a composite file generated from many source files in -the src/ directory. To build Prototype, you'll need: - -* a copy of the Prototype source tree, either from a distribution tarball or - from the darcs repository (see below) -* Ruby 1.8.2 or higher (http://www.ruby-lang.org/) -* Rake -- Ruby Make (http://rake.rubyforge.org/) -* RDoc, if your Ruby distribution does not include it -* darcs 1.0.1 or higher (http://abridgegame.org/darcs/; static binaries - available at http://www.scannedinavian.org/DarcsWiki/CategoryBinaries) - -From the root Prototype directory, - -* rake dist will preprocess the Prototype source using ERB and - generate the composite dist/prototype.js. -* rake package will create a distribution tarball in the - pkg/ directory. - -== Contributing to Prototype - -You'll need the tools mentioned above. Modify the files in src/, add -tests in test/ if possible, generate a new dist file, and record the -changes with darcs record -al. Then email patches to -mailto:sam@conio.net using darcs send. - -== Documentation - -Prototype is embarrassingly lacking in documentation. (The source code should -be fairly easy to comprehend; I'm committed to using a clean style with -meaningful identifiers. But I know that only goes so far.) - -Much of the problem is that there is no easy way to document it from within the -source code itself. I've tried JSDoc[http://jsdoc.sf.net/] and a Perl script -included with JsUnit[http://www.edwardh.com/jsunit/]; neither groks Prototype's -hash-style class definitions or inheritance scheme. Making them work would -require major changes, and I don't have the time for that right now. ============================================================ --- sope-appserver/WEPrototype/prototype/THANKS d7df661b10ea4cbe04cc782c9f9e0e26833681cb +++ /dev/null @@ -1,21 +0,0 @@ -Special thanks are in order for Mikael and Daniel Brockman, whose patterns -heavily influenced the design and implementation of this library. -* Daniel Brockman -- http://www.deepwood.net/ -* Mikael Brockman -- http://www.phubuh.org/ ---- -* Scott Barron -- http://scott.elitists.net/ -* Hemant Bhanoo -* Jamis Buck -- http://jamis.jamisbuck.org/ -* Lucas Carlson -- http://www.rufy.com/ -* Jon Casey -* Patrick Corcoran -* Alper Cugun -* Darren James -- http://www.openrico.org/ -* Marcel Molina Jr. -- http://vernix.org/marcel/ -* Alex Russell -* Chriztian Steinmeier -* Dan Webb -* Gary Wright - -and anyone else who has sent patches or bug reports. If your name isn't on this -list, please forgive my oversight and send me an email (sam at conio.net). \ No newline at end of file ============================================================ --- sope-appserver/WEPrototype/prototype/prototype.js fcdb4aefe1ed1ae58916043631a30affa791fa30 +++ /dev/null @@ -1,1038 +0,0 @@ -/* Prototype JavaScript framework, version 1.3.1 - * (c) 2005 Sam Stephenson - * - * THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff - * against the source tree, available from the Prototype darcs repository. - * - * Prototype is freely distributable under the terms of an MIT-style license. - * - * For details, see the Prototype web site: http://prototype.conio.net/ - * -/*--------------------------------------------------------------------------*/ - -var Prototype = { - Version: '1.3.1', - emptyFunction: function() {} -} - -var Class = { - create: function() { - return function() { - this.initialize.apply(this, arguments); - } - } -} - -var Abstract = new Object(); - -Object.extend = function(destination, source) { - for (property in source) { - destination[property] = source[property]; - } - return destination; -} - -Object.prototype.extend = function(object) { - return Object.extend.apply(this, [this, object]); -} - -Function.prototype.bind = function(object) { - var __method = this; - return function() { - __method.apply(object, arguments); - } -} - -Function.prototype.bindAsEventListener = function(object) { - var __method = this; - return function(event) { - __method.call(object, event || window.event); - } -} - -Number.prototype.toColorPart = function() { - var digits = this.toString(16); - if (this < 16) return '0' + digits; - return digits; -} - -var Try = { - these: function() { - var returnValue; - - for (var i = 0; i < arguments.length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) {} - } - - return returnValue; - } -} - -/*--------------------------------------------------------------------------*/ - -var PeriodicalExecuter = Class.create(); -PeriodicalExecuter.prototype = { - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.callback(); - } finally { - this.currentlyExecuting = false; - } - } - } -} - -/*--------------------------------------------------------------------------*/ - -function $() { - var elements = new Array(); - - for (var i = 0; i < arguments.length; i++) { - var element = arguments[i]; - if (typeof element == 'string') - element = document.getElementById(element); - - if (arguments.length == 1) - return element; - - elements.push(element); - } - - return elements; -} - -if (!Array.prototype.push) { - Array.prototype.push = function() { - var startLength = this.length; - for (var i = 0; i < arguments.length; i++) - this[startLength + i] = arguments[i]; - return this.length; - } -} - -if (!Function.prototype.apply) { - // Based on code from http://www.youngpup.net/ - Function.prototype.apply = function(object, parameters) { - var parameterStrings = new Array(); - if (!object) object = window; - if (!parameters) parameters = new Array(); - - for (var i = 0; i < parameters.length; i++) - parameterStrings[i] = 'parameters[' + i + ']'; - - object.__apply__ = this; - var result = eval('object.__apply__(' + - parameterStrings[i].join(', ') + ')'); - object.__apply__ = null; - - return result; - } -} - -String.prototype.extend({ - stripTags: function() { - return this.replace(/<\/?[^>]+>/gi, ''); - }, - - escapeHTML: function() { - var div = document.createElement('div'); - var text = document.createTextNode(this); - div.appendChild(text); - return div.innerHTML; - }, - - unescapeHTML: function() { - var div = document.createElement('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0].nodeValue; - } -}); - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')}, - function() {return new XMLHttpRequest()} - ) || false; - } -} - -Ajax.Base = function() {}; -Ajax.Base.prototype = { - setOptions: function(options) { - this.options = { - method: 'post', - asynchronous: true, - parameters: '' - }.extend(options || {}); - }, - - responseIsSuccess: function() { - return this.transport.status == undefined - || this.transport.status == 0 - || (this.transport.status >= 200 && this.transport.status < 300); - }, - - responseIsFailure: function() { - return !this.responseIsSuccess(); - } -} - -Ajax.Request = Class.create(); -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -Ajax.Request.prototype = (new Ajax.Base()).extend({ - initialize: function(url, options) { - this.transport = Ajax.getTransport(); - this.setOptions(options); - this.request(url); - }, - - request: function(url) { - var parameters = this.options.parameters || ''; - if (parameters.length > 0) parameters += '&_='; - - try { - if (this.options.method == 'get') - url += '?' + parameters; - - this.transport.open(this.options.method, url, - this.options.asynchronous); - - if (this.options.asynchronous) { - this.transport.onreadystatechange = this.onStateChange.bind(this); - setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10); - } - - this.setRequestHeaders(); - - var body = this.options.postBody ? this.options.postBody : parameters; - this.transport.send(this.options.method == 'post' ? body : null); - - } catch (e) { - } - }, - - setRequestHeaders: function() { - var requestHeaders = - ['X-Requested-With', 'XMLHttpRequest', - 'X-Prototype-Version', Prototype.Version]; - - if (this.options.method == 'post') { - requestHeaders.push('Content-type', - 'application/x-www-form-urlencoded'); - - /* Force "Connection: close" for Mozilla browsers to work around - * a bug where XMLHttpReqeuest sends an incorrect Content-length - * header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType) - requestHeaders.push('Connection', 'close'); - } - - if (this.options.requestHeaders) - requestHeaders.push.apply(requestHeaders, this.options.requestHeaders); - - for (var i = 0; i < requestHeaders.length; i += 2) - this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]); - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState != 1) - this.respondToReadyState(this.transport.readyState); - }, - - respondToReadyState: function(readyState) { - var event = Ajax.Request.Events[readyState]; - - if (event == 'Complete') - (this.options['on' + this.transport.status] - || this.options['on' + this.responseIsSuccess() ? 'Success' : 'Failure'] - || Prototype.emptyFunction)(this.transport); - - (this.options['on' + event] || Prototype.emptyFunction)(this.transport); - - /* Avoid memory leak in MSIE: clean up the oncomplete event handler */ - if (event == 'Complete') - this.transport.onreadystatechange = Prototype.emptyFunction; - } -}); - -Ajax.Updater = Class.create(); -Ajax.Updater.ScriptFragment = '(?:)((\n|.)*?)(?:<\/script>)'; - -Ajax.Updater.prototype.extend(Ajax.Request.prototype).extend({ - initialize: function(container, url, options) { - this.containers = { - success: container.success ? $(container.success) : $(container), - failure: container.failure ? $(container.failure) : - (container.success ? null : $(container)) - } - - this.transport = Ajax.getTransport(); - this.setOptions(options); - - var onComplete = this.options.onComplete || Prototype.emptyFunction; - this.options.onComplete = (function() { - this.updateContent(); - onComplete(this.transport); - }).bind(this); - - this.request(url); - }, - - updateContent: function() { - var receiver = this.responseIsSuccess() ? - this.containers.success : this.containers.failure; - - var match = new RegExp(Ajax.Updater.ScriptFragment, 'img'); - var response = this.transport.responseText.replace(match, ''); - var scripts = this.transport.responseText.match(match); - - if (receiver) { - if (this.options.insertion) { - new this.options.insertion(receiver, response); - } else { - receiver.innerHTML = response; - } - } - - if (this.responseIsSuccess()) { - if (this.onComplete) - setTimeout((function() {this.onComplete( - this.transport)}).bind(this), 10); - } - - if (this.options.evalScripts && scripts) { - match = new RegExp(Ajax.Updater.ScriptFragment, 'im'); - setTimeout((function() { - for (var i = 0; i < scripts.length; i++) - eval(scripts[i].match(match)[1]); - }).bind(this), 10); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(); -Ajax.PeriodicalUpdater.prototype = (new Ajax.Base()).extend({ - initialize: function(container, url, options) { - this.setOptions(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = 1; - - this.updater = {}; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Ajax.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(request) { - if (this.options.decay) { - this.decay = (request.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = request.responseText; - } - this.timer = setTimeout(this.onTimerEvent.bind(this), - this.decay * this.frequency * 1000); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); - -document.getElementsByClassName = function(className) { - var children = document.getElementsByTagName('*') || document.all; - var elements = new Array(); - - for (var i = 0; i < children.length; i++) { - var child = children[i]; - var classNames = child.className.split(' '); - for (var j = 0; j < classNames.length; j++) { - if (classNames[j] == className) { - elements.push(child); - break; - } - } - } - - return elements; -} - -/*--------------------------------------------------------------------------*/ - -if (!window.Element) { - var Element = new Object(); -} - -Object.extend(Element, { - toggle: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - element.style.display = - (element.style.display == 'none' ? '' : 'none'); - } - }, - - hide: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - element.style.display = 'none'; - } - }, - - show: function() { - for (var i = 0; i < arguments.length; i++) { - var element = $(arguments[i]); - element.style.display = ''; - } - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - }, - - getHeight: function(element) { - element = $(element); - return element.offsetHeight; - }, - - hasClassName: function(element, className) { - element = $(element); - if (!element) - return; - var a = element.className.split(' '); - for (var i = 0; i < a.length; i++) { - if (a[i] == className) - return true; - } - return false; - }, - - addClassName: function(element, className) { - element = $(element); - Element.removeClassName(element, className); - element.className += ' ' + className; - }, - - removeClassName: function(element, className) { - element = $(element); - if (!element) - return; - var newClassName = ''; - var a = element.className.split(' '); - for (var i = 0; i < a.length; i++) { - if (a[i] != className) { - if (i > 0) - newClassName += ' '; - newClassName += a[i]; - } - } - element.className = newClassName; - }, - - // removes whitespace-only text node children - cleanWhitespace: function(element) { - var element = $(element); - for (var i = 0; i < element.childNodes.length; i++) { - var node = element.childNodes[i]; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - Element.remove(node); - } - } -}); - -var Toggle = new Object(); -Toggle.display = Element.toggle; - -/*--------------------------------------------------------------------------*/ - -Abstract.Insertion = function(adjacency) { - this.adjacency = adjacency; -} - -Abstract.Insertion.prototype = { - initialize: function(element, content) { - this.element = $(element); - this.content = content; - - if (this.adjacency && this.element.insertAdjacentHTML) { - this.element.insertAdjacentHTML(this.adjacency, this.content); - } else { - this.range = this.element.ownerDocument.createRange(); - if (this.initializeRange) this.initializeRange(); - this.fragment = this.range.createContextualFragment(this.content); - this.insertContent(); - } - } -} - -var Insertion = new Object(); - -Insertion.Before = Class.create(); -Insertion.Before.prototype = (new Abstract.Insertion('beforeBegin')).extend({ - initializeRange: function() { - this.range.setStartBefore(this.element); - }, - - insertContent: function() { - this.element.parentNode.insertBefore(this.fragment, this.element); - } -}); - -Insertion.Top = Class.create(); -Insertion.Top.prototype = (new Abstract.Insertion('afterBegin')).extend({ - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(true); - }, - - insertContent: function() { - this.element.insertBefore(this.fragment, this.element.firstChild); - } -}); - -Insertion.Bottom = Class.create(); -Insertion.Bottom.prototype = (new Abstract.Insertion('beforeEnd')).extend({ - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(this.element); - }, - - insertContent: function() { - this.element.appendChild(this.fragment); - } -}); - -Insertion.After = Class.create(); -Insertion.After.prototype = (new Abstract.Insertion('afterEnd')).extend({ - initializeRange: function() { - this.range.setStartAfter(this.element); - }, - - insertContent: function() { - this.element.parentNode.insertBefore(this.fragment, - this.element.nextSibling); - } -}); - -var Field = { - clear: function() { - for (var i = 0; i < arguments.length; i++) - $(arguments[i]).value = ''; - }, - - focus: function(element) { - $(element).focus(); - }, - - present: function() { - for (var i = 0; i < arguments.length; i++) - if ($(arguments[i]).value == '') return false; - return true; - }, - - select: function(element) { - $(element).select(); - }, - - activate: function(element) { - $(element).focus(); - $(element).select(); - } -} - -/*--------------------------------------------------------------------------*/ - -var Form = { - serialize: function(form) { - var elements = Form.getElements($(form)); - var queryComponents = new Array(); - - for (var i = 0; i < elements.length; i++) { - var queryComponent = Form.Element.serialize(elements[i]); - if (queryComponent) - queryComponents.push(queryComponent); - } - - return queryComponents.join('&'); - }, - - getElements: function(form) { - var form = $(form); - var elements = new Array(); - - for (tagName in Form.Element.Serializers) { - var tagElements = form.getElementsByTagName(tagName); - for (var j = 0; j < tagElements.length; j++) - elements.push(tagElements[j]); - } - return elements; - }, - - getInputs: function(form, typeName, name) { - var form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) - return inputs; - - var matchingInputs = new Array(); - for (var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || - (name && input.name != name)) - continue; - matchingInputs.push(input); - } - - return matchingInputs; - }, - - disable: function(form) { - var elements = Form.getElements(form); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - element.blur(); - element.disabled = 'true'; - } - }, - - enable: function(form) { - var elements = Form.getElements(form); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - element.disabled = ''; - } - }, - - focusFirstElement: function(form) { - var form = $(form); - var elements = Form.getElements(form); - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - if (element.type != 'hidden' && !element.disabled) { - Field.activate(element); - break; - } - } - }, - - reset: function(form) { - $(form).reset(); - } -} - -Form.Element = { - serialize: function(element) { - var element = $(element); - var method = element.tagName.toLowerCase(); - var parameter = Form.Element.Serializers[method](element); - - if (parameter) - return encodeURIComponent(parameter[0]) + '=' + - encodeURIComponent(parameter[1]); - }, - - getValue: function(element) { - var element = $(element); - var method = element.tagName.toLowerCase(); - var parameter = Form.Element.Serializers[method](element); - - if (parameter) - return parameter[1]; - } -} - -Form.Element.Serializers = { - input: function(element) { - switch (element.type.toLowerCase()) { - case 'submit': - case 'hidden': - case 'password': - case 'text': - return Form.Element.Serializers.textarea(element); - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element); - } - return false; - }, - - inputSelector: function(element) { - if (element.checked) - return [element.name, element.value]; - }, - - textarea: function(element) { - return [element.name, element.value]; - }, - - select: function(element) { - var value = ''; - if (element.type == 'select-one') { - var index = element.selectedIndex; - if (index >= 0) - value = element.options[index].value || element.options[index].text; - } else { - value = new Array(); - for (var i = 0; i < element.length; i++) { - var opt = element.options[i]; - if (opt.selected) - value.push(opt.value || opt.text); - } - } - return [element.name, value]; - } -} - -/*--------------------------------------------------------------------------*/ - -var $F = Form.Element.getValue; - -/*--------------------------------------------------------------------------*/ - -Abstract.TimedObserver = function() {} -Abstract.TimedObserver.prototype = { - initialize: function(element, frequency, callback) { - this.frequency = frequency; - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - } -} - -Form.Element.Observer = Class.create(); -Form.Element.Observer.prototype = (new Abstract.TimedObserver()).extend({ - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(); -Form.Observer.prototype = (new Abstract.TimedObserver()).extend({ - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = function() {} -Abstract.EventObserver.prototype = { - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - var elements = Form.getElements(this.element); - for (var i = 0; i < elements.length; i++) - this.registerCallback(elements[i]); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - element.target = this; - element.prev_onclick = element.onclick || Prototype.emptyFunction; - element.onclick = function() { - this.prev_onclick(); - this.target.onElementEvent(); - } - break; - case 'password': - case 'text': - case 'textarea': - case 'select-one': - case 'select-multiple': - element.target = this; - element.prev_onchange = element.onchange || Prototype.emptyFunction; - element.onchange = function() { - this.prev_onchange(); - this.target.onElementEvent(); - } - break; - } - } - } -} - -Form.Element.EventObserver = Class.create(); -Form.Element.EventObserver.prototype = (new Abstract.EventObserver()).extend({ - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(); -Form.EventObserver.prototype = (new Abstract.EventObserver()).extend({ - getValue: function() { - return Form.serialize(this.element); - } -}); - - -if (!window.Event) { - var Event = new Object(); -} - -Object.extend(Event, { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - - element: function(event) { - return event.target || event.srcElement; - }, - - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, - - pointerX: function(event) { - return event.pageX || (event.clientX + - (document.documentElement.scrollLeft || document.body.scrollLeft)); - }, - - pointerY: function(event) { - return event.pageY || (event.clientY + - (document.documentElement.scrollTop || document.body.scrollTop)); - }, - - stop: function(event) { - if (event.preventDefault) { - event.preventDefault(); - event.stopPropagation(); - } else { - event.returnValue = false; - } - }, - - // find the first node with the given tagName, starting from the - // node the event was triggered on; traverses the DOM upwards - findElement: function(event, tagName) { - var element = Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))) - element = element.parentNode; - return element; - }, - - observers: false, - - _observeAndCache: function(element, name, observer, useCapture) { - if (!this.observers) this.observers = []; - if (element.addEventListener) { - this.observers.push([element, name, observer, useCapture]); - element.addEventListener(name, observer, useCapture); - } else if (element.attachEvent) { - this.observers.push([element, name, observer, useCapture]); - element.attachEvent('on' + name, observer); - } - }, - - unloadCache: function() { - if (!Event.observers) return; - for (var i = 0; i < Event.observers.length; i++) { - Event.stopObserving.apply(this, Event.observers[i]); - Event.observers[i][0] = null; - } - Event.observers = false; - }, - - observe: function(element, name, observer, useCapture) { - var element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - ((navigator.appVersion.indexOf('AppleWebKit') > 0) - || element.attachEvent)) - name = 'keydown'; - - this._observeAndCache(element, name, observer, useCapture); - }, - - stopObserving: function(element, name, observer, useCapture) { - var element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - ((navigator.appVersion.indexOf('AppleWebKit') > 0) - || element.detachEvent)) - name = 'keydown'; - - if (element.removeEventListener) { - element.removeEventListener(name, observer, useCapture); - } else if (element.detachEvent) { - element.detachEvent('on' + name, observer); - } - } -}); - -/* prevent memory leaks in IE */ -Event.observe(window, 'unload', Event.unloadCache, false); - -var Position = { - - // set to true if needed, warning: firefox performance problems - // NOT neeeded for page scrolling, only if draggable contained in - // scrollable elements - includeScrollOffsets: false, - - // must be called before calling withinIncludingScrolloffset, every time the - // page is scrolled - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - realOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return [valueL, valueT]; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return [valueL, valueT]; - }, - - // caches x/y coordinate pair to use with overlap - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = this.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = this.realOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = this.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - // within must be called directly before - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - clone: function(source, target) { - source = $(source); - target = $(target); - target.style.position = 'absolute'; - var offsets = this.cumulativeOffset(source); - target.style.top = offsets[1] + 'px'; - target.style.left = offsets[0] + 'px'; - target.style.width = source.offsetWidth + 'px'; - target.style.height = source.offsetHeight + 'px'; - } -} ============================================================ --- sope-appserver/WEPrototype/scriptaculous/CHANGELOG efe0c8a281844d4d320538d07cb28155036599ca +++ /dev/null @@ -1,101 +0,0 @@ -*1.0.0* - -* Changed auto-hiding update div in Ajax.Autocompleter - -* Changed default serialization on Ajax.Autocompleter to use Form.Element.serialize - -* Added test file for drag/drop inside scrolled elements - -* Fixed dragging of unpositioned elements in Internet Explorer - -* Change default behaviour of Ajax.Autocompleter to do automatic overlapping, sizing and appear/fade effects - -* Fixed Internet Explorer hide-windowed-controls iframe handling - -* Changed Ajax.Autocompleter event handling - -* Added onShow/onHide callbacks to Ajax.Autocompleter to allow for customized handling/effects - -* Fixed SlideUp/SlideDown to restore the overflow CSS property (note: Firefox 1.0.X is buggy, set overflow:hidden as a workaround) - -* Fixed BlindUp/BlindDown to restore the overflow CSS property (note: Firefox 1.0.X is buggy, set overflow:hidden as a workaround) - -* Fixed draggables with revert:false on repeated drags behaving badly - -* Expanded the revert option on draggables to optionally take a function and revert only if it returns true - -* Added the dragged element as a parameter to the Draggables.notify callbacks [Michael Sokolov] - -* Removed a deprecated reference to Effect2 om Effect.Fold - -* Make the percentage on Element.setContentZoom absolute - -* Corrected rendering of Ajax.AutoCompleter when focus is lost while updating - -* Added (crude) functional tests - -* Some slight refactoring in controls.js - -* Changed dragdrop.js to use the Effect namespace for its effects - -* Updated to Prototype 1.3.0: removal of prototype-ext.js; refactoring. - -* Fixed behaviour of cursor keys in Safari on autocomplete script - -* Fixed Position.within_including_scrolloffsets - -* Fixed sortables that are absolutely positioned - -* Fixed unhandled whitespace in Ajax.Autocompleter - -* Updated prototype-ext.js to include additions for Ajax.Autocompleter - -* Added controls.js, contains AJAX autocompleting text fields from #960 - -* Refactored Event object - -* Renamed effects2.js to effects.js - -* Fixed draggables on pages with no droppables - -* Moved Event, Position and Element.Class to prototype-ext.js in preparation to Rails 0.13 - -* Added Effect.Transitions.pulse - -* Added Effect.Pulsate and Effect.Fold effect by Justin Palmer - -* Added transitions by Mark Pilgrim: .full, .none - -* Added effects by Mark Pilgrim: Effect.Grow, Effect.Shrink - -* Changed effects namespace to Effect. (Effect2 is deprecated, but works too) - -* Changed old Effect.ContentZoom class to Element.setContentZoom() function - -* Greatly expanded Effect.Highlight to have user-defined colors and autodetecting the background color - -* Converted remaining effects (Squish, Highlight) to new format - -* Sortable.create now passes the zindex, starteffect, reverteffect and endeffect options to the underlying Draggables - -* Sortable.serialize now honors the only option on Sortable.create - -* New overridable options on Draggables: zindex, starteffect, reverteffect, endeffect - -* Fix a Gecko engine flicker on Sortables in dragdrop.js - -* Fixed event.isLeftClick - -* Some small changes in effects2.js - -* Refactoring of dragdrop.js - -* Added an Object.prototype.inspect() and more verbose messages for js unit testing - -* Added test/unittest.js and initial tests in test/html. - -* Cleaning up of effects2.js (convert tabs to spaces) - -* Added Rakefile for distribution packaging (default task = make distribution, rake clean for cleaning up) - -* Initial check-in and directory layout for the script.aculo.us JavaScripts \ No newline at end of file ============================================================ --- sope-appserver/WEPrototype/scriptaculous/MIT-LICENSE a27298d38f81b1718045ebebbb0ea97da601d801 +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file ============================================================ --- sope-appserver/WEPrototype/scriptaculous/README b1d0767bba133412ad2da28bbce6ae490be3834f +++ /dev/null @@ -1,11 +0,0 @@ -== script.aculo.us web 2.0 javascript - -The Web is changing. The 30-year-old terminal-like technology it was originally -is gradually giving way to new ways of doing things. The power of AJAX allows -for rich user interaction without the trouble that has bugged traditional -web applications. - -Building upon the wonderful Prototype JavaScript library, script.aculo.us -provides you with some great additional ingredients to mix in. - -For more information, see http://script.aculo.us/ \ No newline at end of file ============================================================ --- sope-appserver/WEPrototype/scriptaculous/controls.js a3fe57d551c7b1e90682b86a202f363f1a9351ab +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Element.collectTextNodesIgnoreClass = function(element, ignoreclass) { - var children = $(element).childNodes; - var text = ""; - var classtest = new RegExp("^([^ ]+ )*" + ignoreclass+ "( [^ ]+)*$","i"); - - for (var i = 0; i < children.length; i++) { - if(children[i].nodeType==3) { - text+=children[i].nodeValue; - } else { - if((!children[i].className.match(classtest)) && children[i].hasChildNodes()) - text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass); - } - } - - return text; -} - -Ajax.Autocompleter = Class.create(); -Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({ - initialize: function(element, update, url, options) { - this.element = $(element); - this.update = $(update); - this.has_focus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entry_count = 0; - this.url = url; - - this.setOptions(options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this) - this.options.frequency = this.options.frequency || 0.4; - this.options.min_chars = this.options.min_chars || 1; - this.options.method = 'post'; - - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - var offsets = Position.cumulativeOffset(element); - update.style.left = offsets[0] + 'px'; - update.style.top = (offsets[1] + element.offsetHeight) + 'px'; - update.style.width = element.offsetWidth + 'px'; - } - new Effect.Appear(update,{duration:0.3}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.3}) }; - - - if(this.options.indicator) - this.indicator = $(this.options.indicator); - - this.observer = null; - - Element.hide(this.update); - - Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(this.update.style.display=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && this.update.style.position=='absolute') { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) { - Position.clone(this.update, this.iefix); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - } - }, - - hide: function() { - if(this.update.style.display=='') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.indicator) Element.show(this.indicator); - }, - - stopIndicator: function() { - if(this.indicator) Element.hide(this.indicator); - }, - - onObserverEvent: function() { - this.changed = false; - if(this.element.value.length>=this.options.min_chars) { - this.startIndicator(); - this.options.parameters = this.options.callback ? - this.options.callback(this.element, Form.Element.getValue(this.element)) : - Form.Element.serialize(this.element); - new Ajax.Request(this.url, this.options); - } else { - this.active = false; - this.hide(); - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onComplete: function(request) { - if(!this.changed && this.has_focus) { - this.update.innerHTML = request.responseText; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.firstChild); - - if(this.update.firstChild && this.update.firstChild.childNodes) { - this.entry_count = - this.update.firstChild.childNodes.length; - for (var i = 0; i < this.entry_count; i++) { - entry = this.get_entry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entry_count = 0; - } - - this.stopIndicator(); - - this.index = 0; - this.render(); - } - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.select_entry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.mark_previous(); - this.render(); - if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); - return; - case Event.KEY_DOWN: - this.mark_next(); - this.render(); - if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN) - return; - - this.changed = true; - this.has_focus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.select_entry(); - Event.stop(event); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.has_focus = false; - this.active = false; - }, - - render: function() { - if(this.entry_count > 0) { - for (var i = 0; i < this.entry_count; i++) - this.index==i ? - Element.addClassName(this.get_entry(i),"selected") : - Element.removeClassName(this.get_entry(i),"selected"); - - if(this.has_focus) { - if(this.get_current_entry().scrollIntoView) - this.get_current_entry().scrollIntoView(false); - - this.show(); - this.active = true; - } - } else this.hide(); - }, - - mark_previous: function() { - if(this.index > 0) this.index-- - else this.index = this.entry_count-1; - }, - - mark_next: function() { - if(this.index < this.entry_count-1) this.index++ - else this.index = 0; - }, - - get_entry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - get_current_entry: function() { - return this.get_entry(this.index); - }, - - select_entry: function() { - this.active = false; - value = Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'informal').unescapeHTML(); - this.element.value = value; - this.element.focus(); - } -}); \ No newline at end of file ============================================================ --- sope-appserver/WEPrototype/scriptaculous/dragdrop.js 51299781eb09ebbf27f4a2e60f9d27f6a27c0bad +++ /dev/null @@ -1,476 +0,0 @@ -// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// -// Element.Class part Copyright (c) 2005 by Rick Olson -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Element.Class = { - // Element.toggleClass(element, className) toggles the class being on/off - // Element.toggleClass(element, className1, className2) toggles between both classes, - // defaulting to className1 if neither exist - toggle: function(element, className) { - if(Element.Class.has(element, className)) { - Element.Class.remove(element, className); - if(arguments.length == 3) Element.Class.add(element, arguments[2]); - } else { - Element.Class.add(element, className); - if(arguments.length == 3) Element.Class.remove(element, arguments[2]); - } - }, - - // gets space-delimited classnames of an element as an array - get: function(element) { - element = $(element); - return element.className.split(' '); - }, - - // functions adapted from original functions by Gavin Kistner - remove: function(element) { - element = $(element); - var regEx; - for(var i = 1; i < arguments.length; i++) { - regEx = new RegExp("^" + arguments[i] + "\\b\\s*|\\s*\\b" + arguments[i] + "\\b", 'g'); - element.className = element.className.replace(regEx, '') - } - }, - - add: function(element) { - element = $(element); - for(var i = 1; i < arguments.length; i++) { - Element.Class.remove(element, arguments[i]); - element.className += (element.className.length > 0 ? ' ' : '') + arguments[i]; - } - }, - - // returns true if all given classes exist in said element - has: function(element) { - element = $(element); - if(!element || !element.className) return false; - var regEx; - for(var i = 1; i < arguments.length; i++) { - regEx = new RegExp("\\b" + arguments[i] + "\\b"); - if(!regEx.test(element.className)) return false; - } - return true; - }, - - // expects arrays of strings and/or strings as optional paramters - // Element.Class.has_any(element, ['classA','classB','classC'], 'classD') - has_any: function(element) { - element = $(element); - if(!element || !element.className) return false; - var regEx; - for(var i = 1; i < arguments.length; i++) { - if((typeof arguments[i] == 'object') && - (arguments[i].constructor == Array)) { - for(var j = 0; j < arguments[i].length; j++) { - regEx = new RegExp("\\b" + arguments[i][j] + "\\b"); - if(regEx.test(element.className)) return true; - } - } else { - regEx = new RegExp("\\b" + arguments[i] + "\\b"); - if(regEx.test(element.className)) return true; - } - } - return false; - }, - - childrenWith: function(element, className) { - var children = $(element).getElementsByTagName('*'); - var elements = new Array(); - - for (var i = 0; i < children.length; i++) { - if (Element.Class.has(children[i], className)) { - elements.push(children[i]); - break; - } - } - - return elements; - } -} - -/*--------------------------------------------------------------------------*/ - -var Droppables = { - drops: false, - - add: function(element) { - var element = $(element); - var options = { - greedy: true, - hoverclass: null - }.extend(arguments[1] || {}); - - // cache containers - if(options.containment) { - options._containers = new Array(); - var containment = options.containment; - if((typeof containment == 'object') && - (containment.constructor == Array)) { - for(var i=0; i0) window.scrollBy(0,0); - - Event.stop(event); - } - } -} - -/*--------------------------------------------------------------------------*/ - -SortableObserver = Class.create(); -SortableObserver.prototype = { - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - onEnd: function() { - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -} - -Sortable = { - create: function(element) { - var element = $(element); - var options = { - tag: 'li', // assumes li children, override with tag: 'tagname' - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - hoverclass: null, - onChange: function() {}, - onUpdate: function() {} - }.extend(arguments[1] || {}); - element.sortable = options; - - // build options for the draggables - var options_for_draggable = { - revert: true, - constraint: options.constraint, - handle: handle }; - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass, - onHover: function(element, dropon, overlap) { - if(overlap>0.5) { - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) - oldParentNode.sortable.onChange(element); - if(dropon.parentNode.sortable) - dropon.parentNode.sortable.onChange(element); - } - } else { - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode && oldParentNode.sortable) - oldParentNode.sortable.onChange(element); - if(dropon.parentNode.sortable) - dropon.parentNode.sortable.onChange(element); - } - } - } - } - - // fix for gecko engine - Element.cleanWhitespace(element); - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - // make it so - var elements = element.childNodes; - for (var i = 0; i < elements.length; i++) - if(elements[i].tagName && elements[i].tagName==options.tag.toUpperCase() && - (!options.only || (Element.Class.has(elements[i], options.only)))) { - - // handles are per-draggable - var handle = options.handle ? - Element.Class.childrenWith(elements[i], options.handle)[0] : elements[i]; - - new Draggable(elements[i], options_for_draggable.extend({ handle: handle })); - Droppables.add(elements[i], options_for_droppable); - } - - }, - serialize: function(element) { - var element = $(element); - var options = { - tag: element.sortable.tag, - only: element.sortable.only, - name: element.id - }.extend(arguments[1] || {}); - - var items = $(element).childNodes; - var queryComponents = new Array(); - - for(var i=0; i= this.finishOn) { - this.render(this.options.to); - if(this.finish) this.finish(); - if(this.options.afterFinish) this.options.afterFinish(this); - return; - } - pos = (timePos - this.startOn) / (this.finishOn - this.startOn); - frame = Math.round(pos * this.options.fps * this.options.duration); - if(frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - this.timeout = setTimeout(this.loop.bind(this), 10); - }, - render: function(pos) { - if(this.options.transition) pos = this.options.transition(pos); - pos = pos * (this.options.to-this.options.from); - pos += this.options.from; - if(this.options.beforeUpdate) this.options.beforeUpdate(this); - if(this.update) this.update(pos); - if(this.options.afterUpdate) this.options.afterUpdate(this); - }, - cancel: function() { - if(this.timeout) clearTimeout(this.timeout); - } -} - -Effect.Parallel = Class.create(); - Effect.Parallel.prototype = (new Effect.Base()).extend({ - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - for (var i = 0; i < this.effects.length; i++) - this.effects[i].render(position); - }, - finish: function(position) { - for (var i = 0; i < this.effects.length; i++) - if(this.effects[i].finish) this.effects[i].finish(position); - } - }); - -// Internet Explorer caveat: works only on elements the have -// a 'layout', meaning having a given width or height. -// There is no way to safely set this automatically. -Effect.Opacity = Class.create(); -Effect.Opacity.prototype = (new Effect.Base()).extend({ - initialize: function(element) { - this.element = $(element); - options = { - from: 0.0, - to: 1.0 - }.extend(arguments[1] || {}); - this.start(options); - }, - update: function(position) { - this.setOpacity(position); - }, - setOpacity: function(opacity) { - opacity = (opacity == 1) ? 0.99999 : opacity; - this.element.style.opacity = opacity; - this.element.style.filter = "alpha(opacity:"+opacity*100+")"; - } -}); - -Effect.MoveBy = Class.create(); - Effect.MoveBy.prototype = (new Effect.Base()).extend({ - initialize: function(element, toTop, toLeft) { - this.element = $(element); - this.originalTop = parseFloat(this.element.style.top || '0'); - this.originalLeft = parseFloat(this.element.style.left || '0'); - this.toTop = toTop; - this.toLeft = toLeft; - if(this.element.style.position == "") - this.element.style.position = "relative"; - this.start(arguments[3]); - }, - update: function(position) { - topd = this.toTop * position + this.originalTop; - leftd = this.toLeft * position + this.originalLeft; - this.setPosition(topd, leftd); - }, - setPosition: function(topd, leftd) { - this.element.style.top = topd + "px"; - this.element.style.left = leftd + "px"; - } -}); - -Effect.Scale = Class.create(); -Effect.Scale.prototype = (new Effect.Base()).extend({ - initialize: function(element, percent) { - this.element = $(element) - options = { - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or {} with provided values - scaleFrom: 100.0 - }.extend(arguments[2] || {}); - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - if (this.element.style.fontSize=="") this.sizeEm = 1.0; - if (this.element.style.fontSize && this.element.style.fontSize.indexOf("em")>0) - this.sizeEm = parseFloat(this.element.style.fontSize); - this.factor = (percent/100.0) - (options.scaleFrom/100.0); - if(options.scaleMode=='box') { - this.originalHeight = this.element.clientHeight; - this.originalWidth = this.element.clientWidth; - } else - if(options.scaleMode=='contents') { - this.originalHeight = this.element.scrollHeight; - this.originalWidth = this.element.scrollWidth; - } else { - this.originalHeight = options.scaleMode.originalHeight; - this.originalWidth = options.scaleMode.originalWidth; - } - this.start(options); - }, - - update: function(position) { - currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if(this.options.scaleContent && this.sizeEm) - this.element.style.fontSize = this.sizeEm*currentScale + "em"; - this.setDimensions( - this.originalWidth * currentScale, - this.originalHeight * currentScale); - }, - - setDimensions: function(width, height) { - if(this.options.scaleX) this.element.style.width = width + 'px'; - if(this.options.scaleY) this.element.style.height = height + 'px'; - if(this.options.scaleFromCenter) { - topd = (height - this.originalHeight)/2; - leftd = (width - this.originalWidth)/2; - if(this.element.style.position=='absolute') { - if(this.options.scaleY) this.element.style.top = this.originalTop-topd + "px"; - if(this.options.scaleX) this.element.style.left = this.originalLeft-leftd + "px"; - } else { - if(this.options.scaleY) this.element.style.top = -topd + "px"; - if(this.options.scaleX) this.element.style.left = -leftd + "px"; - } - } - } -}); - -Effect.Highlight = Class.create(); -Effect.Highlight.prototype = (new Effect.Base()).extend({ - initialize: function(element) { - this.element = $(element); - - // try to parse current background color as default for endcolor - // browser stores this as: "rgb(255, 255, 255)", convert to "#ffffff" format - var endcolor = "#ffffff"; - var current = this.element.style.backgroundColor; - if(current && current.slice(0,4) == "rgb(") { - endcolor = "#"; - var cols = current.slice(4,current.length-1).split(','); - var i=0; do { endcolor += parseInt(cols[i]).toColorPart() } while (++i<3); } - - var options = { - startcolor: "#ffff99", - endcolor: endcolor - }.extend(arguments[1] || {}); - - // init color calculations - this.colors_base = [ - parseInt(options.startcolor.slice(1,3),16), - parseInt(options.startcolor.slice(3,5),16), - parseInt(options.startcolor.slice(5),16) ]; - this.colors_delta = [ - parseInt(options.endcolor.slice(1,3),16)-this.colors_base[0], - parseInt(options.endcolor.slice(3,5),16)-this.colors_base[1], - parseInt(options.endcolor.slice(5),16)-this.colors_base[2] ]; - - this.start(options); - }, - update: function(position) { - var colors = [ - Math.round(this.colors_base[0]+(this.colors_delta[0]*position)), - Math.round(this.colors_base[1]+(this.colors_delta[1]*position)), - Math.round(this.colors_base[2]+(this.colors_delta[2]*position)) ]; - this.element.style.backgroundColor = "#" + - colors[0].toColorPart() + colors[1].toColorPart() + colors[2].toColorPart(); - } -}); - - -/* ------------- prepackaged effects ------------- */ - -Effect.Fade = function(element) { - options = { - from: 1.0, - to: 0.0, - afterFinish: function(effect) - { Element.hide(effect.element); - effect.setOpacity(1); } - }.extend(arguments[1] || {}); - new Effect.Opacity(element,options); -} - -Effect.Appear = function(element) { - options = { - from: 0.0, - to: 1.0, - beforeStart: function(effect) - { effect.setOpacity(0); - Element.show(effect.element); }, - afterUpdate: function(effect) - { Element.show(effect.element); } - }.extend(arguments[1] || {}); - new Effect.Opacity(element,options); -} - -Effect.Puff = function(element) { - new Effect.Parallel( - [ new Effect.Scale(element, 200, { sync: true, scaleFromCenter: true }), - new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], - { duration: 1.0, - afterUpdate: function(effect) - { effect.effects[0].element.style.position = 'absolute'; }, - afterFinish: function(effect) - { Element.hide(effect.effects[0].element); } - } - ); -} - -Effect.BlindUp = function(element) { - $(element)._overflow = $(element).style.overflow || 'visible'; - $(element).style.overflow = 'hidden'; - new Effect.Scale(element, 0, - { scaleContent: false, - scaleX: false, - afterFinish: function(effect) - { - Element.hide(effect.element); - effect.element.style.overflow = effect.element._overflow; - } - }.extend(arguments[1] || {}) - ); -} - -Effect.BlindDown = function(element) { - $(element).style.height = '0px'; - $(element)._overflow = $(element).style.overflow || 'visible'; - $(element).style.overflow = 'hidden'; - Element.show(element); - new Effect.Scale(element, 100, - { scaleContent: false, - scaleX: false, - scaleMode: 'contents', - scaleFrom: 0, - afterFinish: function(effect) { - effect.element.style.overflow = effect.element._overflow; - } - }.extend(arguments[1] || {}) - ); -} - -Effect.SwitchOff = function(element) { - new Effect.Appear(element, - { duration: 0.4, - transition: Effect.Transitions.flicker, - afterFinish: function(effect) - { effect.element.style.overflow = 'hidden'; - new Effect.Scale(effect.element, 1, - { duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, - afterUpdate: function(effect) { - if(effect.element.style.position=="") - effect.element.style.position = 'relative'; }, - afterFinish: function(effect) { Element.hide(effect.element); } - } ) - } - } ) -} - -Effect.DropOut = function(element) { - new Effect.Parallel( - [ new Effect.MoveBy(element, 100, 0, { sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0 } ) ], - { duration: 0.5, - afterFinish: function(effect) - { Element.hide(effect.effects[0].element); } - }); -} - -Effect.Shake = function(element) { - new Effect.MoveBy(element, 0, 20, - { duration: 0.05, afterFinish: function(effect) { - new Effect.MoveBy(effect.element, 0, -40, - { duration: 0.1, afterFinish: function(effect) { - new Effect.MoveBy(effect.element, 0, 40, - { duration: 0.1, afterFinish: function(effect) { - new Effect.MoveBy(effect.element, 0, -40, - { duration: 0.1, afterFinish: function(effect) { - new Effect.MoveBy(effect.element, 0, 40, - { duration: 0.1, afterFinish: function(effect) { - new Effect.MoveBy(effect.element, 0, -20, - { duration: 0.05, afterFinish: function(effect) { - }}) }}) }}) }}) }}) }}); -} - -Effect.SlideDown = function(element) { - $(element)._overflow = $(element).style.overflow || 'visible'; - $(element).style.height = '0px'; - $(element).style.overflow = 'hidden'; - $(element).firstChild.style.position = 'relative'; - Element.show(element); - new Effect.Scale(element, 100, - { scaleContent: false, - scaleX: false, - scaleMode: 'contents', - scaleFrom: 0, - afterUpdate: function(effect) - { effect.element.firstChild.style.bottom = - (effect.originalHeight - effect.element.clientHeight) + 'px'; }, - afterFinish: function(effect) - { effect.element.style.overflow = effect.element._overflow; } - }.extend(arguments[1] || {}) - ); -} - -Effect.SlideUp = function(element) { - $(element)._overflow = $(element).style.overflow || 'visible'; - $(element).style.overflow = 'hidden'; - $(element).firstChild.style.position = 'relative'; - Element.show(element); - new Effect.Scale(element, 0, - { scaleContent: false, - scaleX: false, - afterUpdate: function(effect) - { effect.element.firstChild.style.bottom = - (effect.originalHeight - effect.element.clientHeight) + 'px'; }, - afterFinish: function(effect) - { - Element.hide(effect.element); - effect.element.style.overflow = effect.element._overflow; - } - }.extend(arguments[1] || {}) - ); -} - -Effect.Squish = function(element) { - new Effect.Scale(element, 0, - { afterFinish: function(effect) { Element.hide(effect.element); } }); -} - -Effect.Grow = function(element) { - element = $(element); - var options = arguments[1] || {}; - - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - element.style.overflow = 'hidden'; - Element.show(element); - - var direction = options.direction || 'center'; - var moveTransition = options.moveTransition || Effect.Transitions.sinoidal; - var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal; - var opacityTransition = options.opacityTransition || Effect.Transitions.full; - - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = originalWidth; - initialMoveY = moveY = 0; - moveX = -originalWidth; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = originalHeight; - moveY = -originalHeight; - break; - case 'bottom-right': - initialMoveX = originalWidth; - initialMoveY = originalHeight; - moveX = -originalWidth; - moveY = -originalHeight; - break; - case 'center': - initialMoveX = originalWidth / 2; - initialMoveY = originalHeight / 2; - moveX = -originalWidth / 2; - moveY = -originalHeight / 2; - break; - } - - new Effect.MoveBy(element, initialMoveY, initialMoveX, { - duration: 0.01, - beforeUpdate: function(effect) { $(element).style.height = '0px'; }, - afterFinish: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 1.0, from: 0.0, transition: opacityTransition }), - new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: moveTransition }), - new Effect.Scale(element, 100, { - scaleMode: { originalHeight: originalHeight, originalWidth: originalWidth }, - sync: true, scaleFrom: 0, scaleTo: 100, transition: scaleTransition })], - options); } - }); -} - -Effect.Shrink = function(element) { - element = $(element); - var options = arguments[1] || {}; - - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - element.style.overflow = 'hidden'; - Element.show(element); - - var direction = options.direction || 'center'; - var moveTransition = options.moveTransition || Effect.Transitions.sinoidal; - var scaleTransition = options.scaleTransition || Effect.Transitions.sinoidal; - var opacityTransition = options.opacityTransition || Effect.Transitions.none; - - var moveX, moveY; - - switch (direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = originalWidth; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = originalHeight; - break; - case 'bottom-right': - moveX = originalWidth; - moveY = originalHeight; - break; - case 'center': - moveX = originalWidth / 2; - moveY = originalHeight / 2; - break; - } - - new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: opacityTransition }), - new Effect.Scale(element, 0, { sync: true, transition: moveTransition }), - new Effect.MoveBy(element, moveY, moveX, { sync: true, transition: scaleTransition }) ], - options); -} - -Effect.Pulsate = function(element) { - var options = arguments[1] || {}; - var transition = options.transition || Effect.Transitions.sinoidal; - var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) }; - reverser.bind(transition); - new Effect.Opacity(element, - { duration: 3.0, - afterFinish: function(effect) { Element.show(effect.element); } - }.extend(options).extend({transition: reverser})); -} - -Effect.Fold = function(element) { - $(element).style.overflow = 'hidden'; - new Effect.Scale(element, 5, { - scaleContent: false, - scaleTo: 100, - scaleX: false, - afterFinish: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleTo: 0, - scaleY: false, - afterFinish: function(effect) { Element.hide(effect.element) } }); - }}.extend(arguments[1] || {})); -} - -// old: new Effect.ContentZoom(element, percent) -// new: Element.setContentZoom(element, percent) - -Element.setContentZoom = function(element, percent) { - var element = $(element); - element.style.fontSize = (percent/100) + "em"; - if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); -} ============================================================ --- sope-appserver/WOXML/COPYING 44f7289042b71631acac29b2f143330d2da2479e +++ /dev/null @@ -1,482 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! ============================================================ --- sope-appserver/WOXML/COPYRIGHT d73b67144fa010527c1ae6148e164cd3becc19c1 +++ /dev/null @@ -1,4 +0,0 @@ -Copyright (C) 2000-2005 SKYRIX Software AG - - -Contact: info@skyrix.com ============================================================ --- sope-appserver/WOXML/ChangeLog b9d64c7a3500bac78257643261f15b23e224692c +++ /dev/null @@ -1,50 +0,0 @@ -2006-07-03 Helge Hess - - * use %p for pointer formats (v4.5.9) - -2005-05-03 Helge Hess - - * WOXMLMapDecoder.m: fixed a gcc 4.0 warnings, changed for the new - DOM implementation naming (v4.5.8) - -2004-08-40 Helge Hess - - * added hack to install the project in FHS locations - the library, - its headers, the tools and the resources will be installed in - FHS_INSTALL_ROOT if specified (eg make FHS_INSTALL_ROOT=/usr/local) - (v4.3.7) - -2004-08-20 Helge Hess - - * moved to SOPE 4.3 (v4.3.6) - -2004-07-29 Frank Reppin - - * GNUmakefile.preamble: added libWOXML_SOVERSION (v4.2.5) - -2004-07-29 Frank Reppin - - * GNUmakefile: inherit Version from skyrix-sope (v4.2.4) - -2004-06-10 Helge Hess - - * GNUmakefile.prebinding: added prebinding (v4.2.3) - -2004-04-28 Marcus Mueller - - * v4.2.2 - - * WOXML-Info.plist: new file for Xcode project - - * common.h: include NGObjectMacros if NeXT_Foundation_LIBRARY is set. - - * WOXMLDecoder.m: Workaround for missing subclassResponsibility: in - NeXT and Apple runtimes. - - * WOXMLSaxModelHandler.m: include common.h (NGObjectMacros) - -2004-04-24 Helge Hess - - * added WOXML to OGo/SOPE - - * created ChangeLog ============================================================ --- sope-appserver/WOXML/GNUmakefile 4f7b33ca6fb8c04a043225794fdebca991270e29 +++ /dev/null @@ -1,54 +0,0 @@ -# GNUstep makefile - -include ../../config.make -include ../common.make -include ../Version -include ./Version - -ifneq ($(frameworks),yes) -LIBRARY_NAME = libWOXML -else -FRAMEWORK_NAME = WOXML -endif - - -libWOXML_PCH_FILE = common.h -libWOXML_HEADER_FILES_DIR = . -libWOXML_HEADER_FILES_INSTALL_DIR = /WOXML -libWOXML_INSTALL_DIR=$(SOPE_SYSLIBDIR) - - -libWOXML_HEADER_FILES += \ - WOXML.h \ - WOXMLDecoder.h \ - WOXMLMappingModel.h \ - -libWOXML_OBJC_FILES += \ - WOXMLDecoder.m \ - \ - WOXMLMapDecoder.m \ - WOXMLMappingEntity.m \ - WOXMLMappingModel.m \ - WOXMLMappingProperty.m \ - WOXMLSaxModelHandler.m \ - -# framework support - -WOXML_PCH_FILE = $(libWOXML_PCH_FILE) -WOXML_HEADER_FILES = $(libWOXML_HEADER_FILES) -WOXML_OBJC_FILES = $(libWOXML_OBJC_FILES) -WOXML_SUBPROJECTS = $(libWOXML_SUBPROJECTS) - - -# building - --include GNUmakefile.preamble -ifneq ($(FHS_INSTALL_ROOT),) -GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include -endif -ifneq ($(frameworks),yes) -include $(GNUSTEP_MAKEFILES)/library.make -else -include $(GNUSTEP_MAKEFILES)/framework.make -endif --include GNUmakefile.postamble ============================================================ --- sope-appserver/WOXML/GNUmakefile.preamble 5fdc85a522c015c0c282c11564f692f3b30137f0 +++ /dev/null @@ -1,50 +0,0 @@ -# compilation settings - -SOPE_ROOT=../.. - -libWOXML_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION) -libWOXML_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION) - -libWOXML_INCLUDE_DIRS += -I. -I.. - - -# dependencies - -libWOXML_LIBRARIES_DEPEND_UPON += -lDOM -lSaxObjC -WOXML_LIBRARIES_DEPEND_UPON += -framework DOM -framework SaxObjC - - -# library/framework search pathes - -DEP_DIRS = \ - $(SOPE_ROOT)/sope-xml/DOM \ - $(SOPE_ROOT)/sope-xml/SaxObjC - -ifneq ($(frameworks),yes) -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),\ - -L$(GNUSTEP_BUILD_DIR)/$(dir)/$(GNUSTEP_OBJ_DIR_NAME)) -else -ADDITIONAL_LIB_DIRS += \ - $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir)) -endif - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64 -else -SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib -endif - - -# Apple - -ifeq ($(FOUNDATION_LIB),apple) -libWOXML_PREBIND_ADDR="0xC5B00000" -libWOXML_LDFLAGS += -seg1addr $(libWOXML_PREBIND_ADDR) -endif - -# Windows - -ifeq ($(GNUSTEP_TARGET_OS),cygwin32) -libWOXML_LIBRARIES_DEPEND_UPON += -lFoundation -lobjc -endif ============================================================ --- sope-appserver/WOXML/README 67b4dc4fbe0267ead6733761b37cdbf7aa121c08 +++ /dev/null @@ -1,7 +0,0 @@ -WOXML -===== - -This directory contains a reimplementation of the WOXML framework in -Objective-C. -It is discouraged to use this framework in OGo, its intended for legacy -ObjC web applications. Please let us know whether it works for you. ============================================================ --- sope-appserver/WOXML/Version 94b6c4cd1e4b81d5f929d8b59ede5009a16ac95f +++ /dev/null @@ -1,3 +0,0 @@ -# Version file - -SUBMINOR_VERSION:=9 ============================================================ --- sope-appserver/WOXML/WOXML-Info.plist 26c30708a30d2e935f15d5d56e7b18994e2571c7 +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - WOXML - CFBundleGetInfoString - - CFBundleIdentifier - com.skyrix.SOPE.WOXML - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - - CFBundleSignature - ???? - CFBundleVersion - 4.2 - - ============================================================ --- sope-appserver/WOXML/WOXML.h 30812596ceee47bd43f5cd400d1b89e5043d4047 +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXML_H__ -#define __WOXML_H__ - -#include -#include -#include -#include - -#endif /* __WOXML_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLDecoder.h 9251b3ebea7cfc349cb6314e02fa13817a7efbd9 +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXML_WOXMLDecoder_H__ -#define __WOXML_WOXMLDecoder_H__ - -#import - -@class NSString, NSData, NSFileHandle; - -@interface WOXMLDecoder : NSObject - -+ (id)xmlDecoderWithMapping:(NSString *)_mapURL; - -/* root object */ - -- (id)decodeRootObjectFromData:(NSData *)_data; -- (id)decodeRootObjectFromString:(NSString *)_str; -- (id)decodeRootObjectFromFileHandle:(NSFileHandle *)_fh; - -@end - -#endif /* __WOXML_WOXMLDecoder_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLDecoder.m 933c0c4fdf70118298e161cdf5f989e21d72d8f4 +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include -#include "WOXMLMappingModel.h" -#include "WOXMLMapDecoder.h" -#include -#include "common.h" - -#if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY -@interface NSObject(Miss) -- (id)subclassResponsibility:(SEL)cmd; -@end -#endif - -@implementation WOXMLDecoder - -+ (id)xmlDecoderWithMapping:(NSString *)_mapURL { - WOXMLMappingModel *model; - - if ((model = [WOXMLMappingModel mappingModelByParsingFromURL:_mapURL]) == nil) - return nil; - - return AUTORELEASE([[WOXMLMapDecoder alloc] initWithModel:model]); -} - -/* root object */ - -- (id)decodeRootObjectFromString:(NSString *)_str { - return [self subclassResponsibility:_cmd]; -} -- (id)decodeRootObjectFromData:(NSData *)_data { - return [self subclassResponsibility:_cmd]; -} - -- (id)decodeRootObjectFromFileHandle:(NSFileHandle *)_fh { - return [self decodeRootObjectFromData:[_fh readDataToEndOfFile]]; -} - -@end /* WOXMLDecoder */ ============================================================ --- sope-appserver/WOXML/WOXMLMapDecoder.h 3e4e5ac0c354f663a3b6b23b5e816e2f404068d3 +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXML_WOXMLMapDecoder_H__ -#define __WOXML_WOXMLMapDecoder_H__ - -#include - -@class WOXMLMappingModel; - -@interface WOXMLMapDecoder : WOXMLDecoder -{ - WOXMLMappingModel *model; -} - -- (id)initWithModel:(WOXMLMappingModel *)_model; - -@end - -#endif /* __WOXML_WOXMLMapDecoder_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLMapDecoder.m 29d222ec99d475ef7dda78432271f1c2fc8d753e +++ /dev/null @@ -1,195 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOXMLMapDecoder.h" -#include "WOXMLMappingModel.h" -#include "WOXMLMappingEntity.h" -#include "WOXMLMappingProperty.h" -#include "common.h" - -#include -#include - -@implementation WOXMLMapDecoder - -- (id)initWithModel:(WOXMLMappingModel *)_model { - self->model = [_model retain]; - return self; -} - -- (void)dealloc { - [self->model release]; - [super dealloc]; -} - -/* operations */ - -- (WOXMLMappingEntity *)defaultEntity { - return nil; -} - -- (id)_processDOMElementNode:(id)_node { - WOXMLMappingEntity *entity; - Class entityClass; - id object; - NSMutableSet *childTags; - - NSAssert1([_node nodeType] == DOM_ELEMENT_NODE, - @"passed invalid element node: %@", _node); - - if ((entity = [self->model entityForXmlTag:[_node tagName]]) == nil) { - /* missing entity */ - entity = [self defaultEntity]; - } - if (entity == nil) - return [_node textValue]; - - entityClass = NSClassFromString([entity name]); - if (entityClass == Nil) entityClass = [NSMutableDictionary class]; - - object = AUTORELEASE([[entityClass alloc] init]); - - childTags = [NSMutableSet setWithCapacity:16]; - - /* apply properties */ - { - NSEnumerator *e; - WOXMLMappingProperty *prop; - - e = [[entity properties] objectEnumerator]; - while ((prop = [e nextObject])) { - if (![prop isValid]) - continue; - - if ([prop attribute]) { - /* an attribute property */ - NSString *attrName; - NSString *value; - - attrName = [prop xmlTag]; - - if ((value = [_node attribute:attrName]) == nil) - value = [_node attribute:attrName namespaceURI:@"*"]; - - if (value) - [object takeValue:value forKey:[prop name]]; - } - else - [childTags addObject:[prop xmlTag]]; - } - } - - /* walk children */ - { - unsigned i, count; - id childNodes; - NSMutableDictionary *d; - - d = [NSMutableDictionary dictionaryWithCapacity:16]; - - childNodes = [_node childNodes]; - for (i = 0, count = [childNodes count]; i < count; i++) { - id child; - - child = [childNodes objectAtIndex:i]; - - if ([child nodeType] == DOM_ELEMENT_NODE) { - if ([childTags containsObject:[child tagName]]) { - /* a property */ - WOXMLMappingProperty *prop; - id o; - - prop = [entity propertyForXmlTag:[child tagName]]; - - o = [self _processDOMElementNode:child]; - if (o == nil) - o = [EONull null]; - - if ([prop forceList]) { - NSMutableArray *a; - - a = [d objectForKey:[prop name]]; - if (a == nil) { - a = [NSMutableArray arrayWithCapacity:1]; - [d setObject:a forKey:[prop name]]; - } - [a addObject:o]; - } - else { - id old; - - if ((old = [d objectForKey:[prop name]])) { - if ([old isKindOfClass:[NSMutableArray class]]) - [old addObject:o]; - else { - NSMutableArray *a; - - a = [NSMutableArray arrayWithCapacity:2]; - [a addObject:old]; - [a addObject:o]; - [d setObject:a forKey:[prop name]]; - } - } - else { - /* first element */ - [d setObject:o forKey:[prop name]]; - } - } - } - else { - /* plain content tag */ - } - } - else { - } - } - [object takeValuesFromDictionary:d]; - } - - return object; -} - -- (id)_processDOMDocument:(id)_dom { - return [self _processDOMElementNode:[_dom documentElement]]; -} - -/* parsing DOM tree */ - -- (id)decodeRootObjectFromString:(NSString *)_str { - id doc; - - doc = [NGDOMDocument documentFromString:_str]; - - return [self _processDOMDocument:doc]; -} - -- (id)decodeRootObjectFromData:(NSData *)_data { - id doc; - - doc = [NGDOMDocument documentFromData:_data]; - - return [self _processDOMDocument:doc]; -} -- (id)decodeRootObjectFromFileHandle:(NSFileHandle *)_fh { - return [self decodeRootObjectFromData:[_fh readDataToEndOfFile]]; -} - -@end /* WOXMLMapDecoder */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingEntity.h 11a9c5fc81d28255f3d8d748137aa4315353052e +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXMLMappingEntity_H__ -#define __WOXMLMappingEntity_H__ - -#import - -@class WOXMLMappingProperty; -@class NSMutableArray, NSString, NSMutableDictionary, NSArray; - -@interface WOXMLMappingEntity : NSObject -{ - NSMutableArray *properties; - NSMutableDictionary *tagToProperty; - - NSString *name; - NSString *xmlTag; - NSString *unmappedTagsKey; - BOOL ignoreUnmappedTags; - NSString *contentsKey; -} - -- (BOOL)isValid; - -/* attributes */ - -- (void)setName:(NSString *)_name; -- (NSString *)name; -- (void)setXmlTag:(NSString *)_xmlTag; -- (NSString *)xmlTag; -- (void)setUnmappedTagsKey:(NSString *)_unmappedTagsKey; -- (NSString *)unmappedTagsKey; -- (void)setContentsKey:(NSString *)_contentsKey; -- (NSString *)contentsKey; -- (void)setIgnoreUnmappedTags:(BOOL)_flag; -- (BOOL)ignoreUnmappedTags; - -/* properties */ - -- (void)addProperty:(WOXMLMappingProperty *)_property; -- (WOXMLMappingProperty *)propertyForXmlTag:(NSString *)_xmlTag; -- (NSArray *)properties; - -@end - -#endif /* __WOXMLMappingEntity_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingEntity.m 5524878f3cfe4d96b90b2d8f5dd643ae7ab7d3ff +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOXMLMappingEntity.h" -#include "WOXMLMappingProperty.h" -#include "common.h" - -@implementation WOXMLMappingEntity - -- (void)dealloc { - RELEASE(self->name); - RELEASE(self->xmlTag); - RELEASE(self->unmappedTagsKey); - RELEASE(self->contentsKey); - RELEASE(self->properties); - [super dealloc]; -} - -/* validity */ - -- (BOOL)isValid { - if ([self->name length] == 0) - return NO; - if ([self->xmlTag length] == 0) - return NO; - return YES; -} - -/* attributes */ - -- (void)setName:(NSString *)_name { - ASSIGN(self->name, _name); -} -- (NSString *)name { - return self->name; -} - -- (void)setXmlTag:(NSString *)_xmlTag { - ASSIGN(self->xmlTag, _xmlTag); -} -- (NSString *)xmlTag { - return self->xmlTag; -} - -- (void)setUnmappedTagsKey:(NSString *)_unmappedTagsKey { - ASSIGN(self->unmappedTagsKey, _unmappedTagsKey); -} -- (NSString *)unmappedTagsKey { - return self->unmappedTagsKey; -} - -- (void)setContentsKey:(NSString *)_contentsKey { - ASSIGN(self->contentsKey, _contentsKey); -} -- (NSString *)contentsKey { - return self->contentsKey; -} - -- (void)setIgnoreUnmappedTags:(BOOL)_flag { - self->ignoreUnmappedTags = _flag; -} -- (BOOL)ignoreUnmappedTags { - return self->ignoreUnmappedTags; -} - -/* properties */ - -- (void)addProperty:(WOXMLMappingProperty *)_property { - NSAssert1([_property isValid], @"tried to add invalid property %@", _property); - - if (self->properties == nil) - self->properties = [[NSMutableArray alloc] init]; - if (self->tagToProperty == nil) - self->tagToProperty = [[NSMutableDictionary alloc] init]; - - if ([self->tagToProperty objectForKey:[_property xmlTag]]) { - NSLog(@"WARNING: already defined propery for tag %@", [_property xmlTag]); - return; - } - - [self->properties addObject:_property]; - [self->tagToProperty setObject:_property forKey:[_property xmlTag]]; -} - -- (WOXMLMappingProperty *)propertyForXmlTag:(NSString *)_xmlTag { - return [self->tagToProperty objectForKey:_xmlTag]; -} - -- (NSArray *)properties { - return self->properties; -} - -/* XML representation */ - -- (NSString *)xmlStringValue { - NSMutableString *s; - NSEnumerator *e; - id prop; - - s = [NSMutableString stringWithCapacity:4096]; - [s appendString:@"\n"]; - - e = [[self properties] objectEnumerator]; - while ((prop = [e nextObject])) - [s appendString:[prop xmlStringValue]]; - - [s appendString:@"\n"]; - return s; -} - -/* description */ - -- (NSString *)description { - NSMutableString *s; - - s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<%@ 0x%p:", NSStringFromClass([self class]), self]; - - if ([self name]) - [s appendFormat:@" name=%@", [self name]]; - if ([self xmlTag]) - [s appendFormat:@" tag=%@", [self xmlTag]]; - if ([self unmappedTagsKey]) - [s appendFormat:@" unmapped=%@", [self unmappedTagsKey]]; - if ([self contentsKey]) - [s appendFormat:@" content=%@", [self contentsKey]]; - - if (self->ignoreUnmappedTags) - [s appendString:@" ignore-unmapped"]; - - [s appendString:@">"]; - return s; -} - -@end /* WOXMLMappingEntity */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingModel.h 34777ef57569e9fa2dda712d8e5041807104353b +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXMLMappingModel_H__ -#define __WOXMLMappingModel_H__ - -#import - -@class NSMutableArray, NSMutableDictionary, NSArray; -@class WOXMLMappingEntity; - -@interface WOXMLMappingModel : NSObject -{ - NSMutableArray *entities; - NSMutableDictionary *tagToEntity; - NSMutableDictionary *tagToAttribute; -} - -+ (id)mappingModelByParsingFromURL:(NSString *)_url; - -/* entities */ - -- (void)addEntity:(WOXMLMappingEntity *)_entity; -- (WOXMLMappingEntity *)entityForXmlTag:(NSString *)_xmlTag; -- (NSArray *)entities; - -@end - -#endif /* __WOXMLMappingModel_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingModel.m 2c9649383f925f2e83bcef7a90fa8f84a3b0c8dd +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOXMLMappingModel.h" -#include "WOXMLMappingEntity.h" -#include "WOXMLSaxModelHandler.h" -#include -#include -#include "common.h" - -@implementation WOXMLMappingModel - -+ (id)mappingModelByParsingFromURL:(NSString *)_url { - id parser; - WOXMLSaxModelHandler *sax; - WOXMLMappingModel *model; - - if ([_url length] == 0) - /* invalid URL */ - return nil; - - parser = [[SaxXMLReaderFactory standardXMLReaderFactory] createXMLReader]; - if (parser == nil) - /* couldn't create parser */ - return nil; - - sax = [[WOXMLSaxModelHandler alloc] init]; - [parser setContentHandler:sax]; - [parser setErrorHandler:sax]; - - [parser parseFromSystemId:_url]; - - model = RETAIN([sax model]); - RELEASE(sax); - - return AUTORELEASE(model); -} - -- (void)dealloc { - RELEASE(self->tagToEntity); - RELEASE(self->entities); - [super dealloc]; -} - -/* entities */ - -- (void)addEntity:(WOXMLMappingEntity *)_entity { - NSAssert1([_entity isValid], @"tried to add invalid entity %@", _entity); - - if (self->entities == nil) - self->entities = [[NSMutableArray alloc] init]; - if (self->tagToEntity == nil) - self->tagToEntity = [[NSMutableDictionary alloc] init]; - - if ([self->tagToEntity objectForKey:[_entity xmlTag]]) { - NSLog(@"WARNING: already defined entity for tag %@", [_entity xmlTag]); - return; - } - - [self->entities addObject:_entity]; - [self->tagToEntity setObject:_entity forKey:[_entity xmlTag]]; -} - -- (WOXMLMappingEntity *)entityForXmlTag:(NSString *)_xmlTag { - return [self->tagToEntity objectForKey:_xmlTag]; -} - -- (NSArray *)entities { - return self->entities; -} - -/* XML representation */ - -- (NSString *)xmlStringValue { - NSMutableString *s; - NSEnumerator *e; - id entity; - - s = [NSMutableString stringWithCapacity:4096]; - [s appendString:@"\n"]; - - e = [[self entities] objectEnumerator]; - while ((entity = [e nextObject])) - [s appendString:[entity xmlStringValue]]; - - [s appendString:@"\n"]; - return s; -} - -@end /* WOXMLMappingModel */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingProperty.h 2d0681f775b319f527e1950a47d2a2bb1db616a2 +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXMLMappingProperty_H__ -#define __WOXMLMappingProperty_H__ - -#import - -@class NSString; -@class WOXMLMappingEntity; - -@interface WOXMLMappingProperty : NSObject -{ - WOXMLMappingEntity *entity; - NSString *name; - NSString *xmlTag; - BOOL attribute; /* used during encoding */ - BOOL forceList; /* decoding only */ - NSString *codeBasedOn; - BOOL reportEmptyValues; /* decoding only */ - NSString *outputTags; /* encoding only ? */ -} - -- (id)initWithEntity:(WOXMLMappingEntity *)_entity; - -/* validity */ - -- (BOOL)isValid; - -/* attributes */ - -- (void)setName:(NSString *)_name; -- (NSString *)name; -- (void)setXmlTag:(NSString *)_xmlTag; -- (NSString *)xmlTag; -- (void)setCodeBasedOn:(NSString *)_codeBasedOn; -- (NSString *)codeBasedOn; -- (void)setOutputTags:(NSString *)_tags; -- (NSString *)outputTags; -- (void)setAttribute:(BOOL)_flag; -- (BOOL)attribute; -- (void)setForceList:(BOOL)_flag; -- (BOOL)forceList; -- (void)setReportEmptyValues:(BOOL)_flag; -- (BOOL)reportEmptyValues; - -@end - -#endif /* __WOXMLMappingProperty_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLMappingProperty.m 87b80be4012006dd2e17c11a0a183caca26aa28d +++ /dev/null @@ -1,157 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOXMLMappingProperty.h" -#include "common.h" - -@implementation WOXMLMappingProperty - -- (id)initWithEntity:(WOXMLMappingEntity *)_entity { - self->entity = _entity; - return self; -} - -- (void)dealloc { - RELEASE(self->name); - RELEASE(self->xmlTag); - RELEASE(self->codeBasedOn); - RELEASE(self->outputTags); - [super dealloc]; -} - -/* validity */ - -- (BOOL)isValid { - if ([self->name length] == 0) - return NO; - if ([self->xmlTag length] == 0) - return NO; - return YES; -} - -- (WOXMLMappingEntity *)entity { - return self->entity; -} - -/* attributes */ - -- (void)setName:(NSString *)_name { - ASSIGN(self->name, _name); -} -- (NSString *)name { - return self->name; -} - -- (void)setXmlTag:(NSString *)_xmlTag { - ASSIGN(self->xmlTag, _xmlTag); -} -- (NSString *)xmlTag { - return self->xmlTag; -} - -- (void)setCodeBasedOn:(NSString *)_codeBasedOn { - ASSIGN(self->codeBasedOn, _codeBasedOn); -} -- (NSString *)codeBasedOn { - return self->codeBasedOn; -} - -- (void)setOutputTags:(NSString *)_tags { - ASSIGN(self->outputTags, _tags); -} -- (NSString *)outputTags { - return self->outputTags; -} - -- (void)setAttribute:(BOOL)_flag { - self->attribute = _flag; -} -- (BOOL)attribute { - return self->attribute; -} - -- (void)setForceList:(BOOL)_flag { - self->forceList = _flag; -} -- (BOOL)forceList { - return self->forceList; -} - -- (void)setReportEmptyValues:(BOOL)_flag { - self->reportEmptyValues = _flag; -} -- (BOOL)reportEmptyValues { - return self->reportEmptyValues; -} - -/* XML representation */ - -- (NSString *)xmlStringValue { - NSMutableString *s; - - s = [NSMutableString stringWithCapacity:100]; - [s appendString:@"\n"]; - return s; -} - -/* description */ - -- (NSString *)description { - NSMutableString *s; - - s = [NSMutableString stringWithCapacity:100]; - [s appendFormat:@"<%@ 0x%p:", NSStringFromClass([self class]), self]; - - if ([self name]) - [s appendFormat:@" name=%@", [self name]]; - if ([self xmlTag]) - [s appendFormat:@" tag=%@", [self xmlTag]]; - if ([self codeBasedOn]) - [s appendFormat:@" codeBasedOn=%@", [self codeBasedOn]]; - if ([self outputTags]) - [s appendFormat:@" out-tags=%@", [self outputTags]]; - - if ([self attribute]) - [s appendString:@" attribute"]; - if ([self forceList]) - [s appendString:@" forceList"]; - if ([self reportEmptyValues]) - [s appendString:@" reportEmptyValues"]; - - [s appendString:@">"]; - return s; -} - -@end /* WOXMLMappingProperty */ ============================================================ --- sope-appserver/WOXML/WOXMLSaxModelHandler.h 0ee3648126979161a62e9621afcb4bcc45a3ebf6 +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXMLSaxModelHandler_H__ -#define __WOXMLSaxModelHandler_H__ - -#include - -@class WOXMLMappingProperty, WOXMLMappingModel, WOXMLMappingEntity; - -@interface WOXMLSaxModelHandler : SaxDefaultHandler -{ - WOXMLMappingModel *currentModel; - WOXMLMappingEntity *currentEntity; - WOXMLMappingProperty *currentProperty; -} - -- (WOXMLMappingModel *)model; - -@end - -#endif /* __WOXMLSaxModelHandler_H__ */ ============================================================ --- sope-appserver/WOXML/WOXMLSaxModelHandler.m 765b53b3333c18124af1ea5087bab59c966720f5 +++ /dev/null @@ -1,182 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "WOXMLSaxModelHandler.h" -#include "WOXMLMappingEntity.h" -#include "WOXMLMappingModel.h" -#include "WOXMLMappingProperty.h" -#include "common.h" - -@implementation WOXMLSaxModelHandler - -- (void)dealloc { - RELEASE(self->currentModel); - RELEASE(self->currentProperty); - RELEASE(self->currentEntity); - [super dealloc]; -} - -- (WOXMLMappingModel *)model { - return AUTORELEASE(RETAIN(self->currentModel)); -} - -/* tag handler */ - -- (void)startModel:(id)_attrs { - if ((self->currentProperty != nil) || (self->currentEntity != nil)) { - NSLog(@"cannot nest 'model' tags inside property or entity tags !"); - return; - } - - RELEASE(self->currentModel); self->currentModel = nil; - self->currentModel = [[WOXMLMappingModel alloc] init]; -} -- (void)endModel { - if ((self->currentProperty != nil) || (self->currentEntity != nil)) - return; -} - -- (void)startEntity:(id)_attrs { - NSString *s; - - if (self->currentProperty) { - NSLog(@"cannot nest 'entity' tags inside property tags !"); - return; - } - if (self->currentEntity) { - NSLog(@"cannot nest 'entity' tags inside entity tags !"); - return; - } - if (self->currentModel == nil) { - NSLog(@"missing 'model' parent element for 'entity' tag !"); - return; - } - - self->currentEntity = [[WOXMLMappingEntity alloc] init]; - - if ((s = [_attrs valueForRawName:@"name"])) - [self->currentEntity setName:s]; - if ((s = [_attrs valueForRawName:@"xmlTag"])) - [self->currentEntity setXmlTag:s]; - if ((s = [_attrs valueForRawName:@"unmappedTagsKey"])) - [self->currentEntity setUnmappedTagsKey:s]; - if ((s = [_attrs valueForRawName:@"contentsKey"])) - [self->currentEntity setContentsKey:s]; - - if ((s = [_attrs valueForRawName:@"ignoreUnmappedTags"])) { - [self->currentEntity setIgnoreUnmappedTags: - [[s uppercaseString] isEqualToString:@"YES"]]; - } -} -- (void)endEntity { - if ((self->currentProperty != nil) || (self->currentModel == nil)) - return; - - if (self->currentEntity) { - if ([self->currentEntity isValid]) - [self->currentModel addEntity:self->currentEntity]; - RELEASE(self->currentEntity); self->currentEntity = nil; - } -} - -- (void)startProperty:(id)_attrs { - NSString *s; - - if (self->currentProperty) { - NSLog(@"cannot nest 'property' tags inside property tags !"); - return; - } - if ((self->currentEntity == nil) || (self->currentModel == nil)) { - NSLog(@"missing 'entity' parent element for 'property' tag !"); - return; - } - - self->currentProperty = [[WOXMLMappingProperty alloc] init]; - - if ((s = [_attrs valueForRawName:@"name"])) - [self->currentProperty setName:s]; - if ((s = [_attrs valueForRawName:@"xmlTag"])) - [self->currentProperty setXmlTag:s]; - if ((s = [_attrs valueForRawName:@"codeBasedOn"])) - [self->currentProperty setCodeBasedOn:s]; - if ((s = [_attrs valueForRawName:@"outputTags"])) - [self->currentProperty setOutputTags:s]; - - if ((s = [_attrs valueForRawName:@"attribute"])) { - [self->currentProperty setAttribute: - [[s uppercaseString] isEqualToString:@"YES"]]; - } - if ((s = [_attrs valueForRawName:@"forceList"])) { - [self->currentProperty setForceList: - [[s uppercaseString] isEqualToString:@"YES"]]; - } - if ((s = [_attrs valueForRawName:@"reportEmptyValues"])) { - [self->currentProperty setReportEmptyValues: - [[s uppercaseString] isEqualToString:@"YES"]]; - } -} -- (void)endProperty { - if ((self->currentEntity == nil) || (self->currentModel == nil)) - return; - - if (self->currentProperty) { - if ([self->currentProperty isValid]) - [self->currentEntity addProperty:self->currentProperty]; - - RELEASE(self->currentProperty); self->currentProperty = nil; - } -} - -/* SAX */ - -- (void)startDocument { - RELEASE(self->currentModel); self->currentModel = nil; - RELEASE(self->currentEntity); self->currentEntity = nil; - RELEASE(self->currentProperty); self->currentProperty = nil; -} -- (void)endDocument { -} - -- (void)startElement:(NSString *)_localName - namespace:(NSString *)_ns - rawName:(NSString *)_rawName - attributes:(id)_attrs -{ - if ([_rawName isEqualToString:@"model"]) - [self startModel:_attrs]; - else if ([_rawName isEqualToString:@"entity"]) - [self startEntity:_attrs]; - else if ([_rawName isEqualToString:@"property"]) - [self startProperty:_attrs]; -} -- (void)endElement:(NSString *)_localName - namespace:(NSString *)_ns - rawName:(NSString *)_rawName -{ - if ([_rawName isEqualToString:@"model"]) - [self endModel]; - else if ([_rawName isEqualToString:@"entity"]) - [self endEntity]; - else if ([_rawName isEqualToString:@"property"]) - [self endProperty]; -} - -@end /* WOXMLSaxModelHandler */ ============================================================ --- sope-appserver/WOXML/common.h 37afdd91e65f26f9bcbc793c06da6ec1d99faa70 +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __WOXML_common_H__ -#define __WOXML_common_H__ - -#import - -#if NeXT_Foundation_LIBRARY -# include -#endif - -#include - -#endif /* __WOXML_common_H__ */ ============================================================ --- sope-appserver/WOXML/fhs.make 418a404ad233ed548592657e25ceb860296046ec +++ /dev/null @@ -1,44 +0,0 @@ -# postprocessing - -# FHS support (this is a hack and is going to be done by gstep-make!) - -ifneq ($(FHS_INSTALL_ROOT),) - -FHS_INCLUDE_DIR=$(FHS_INSTALL_ROOT)/include/ -FHS_BIN_DIR=$(FHS_INSTALL_ROOT)/bin/ - -ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64) -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib64/ -else -FHS_LIB_DIR=$(FHS_INSTALL_ROOT)/lib/ -endif - -NONFHS_LIBDIR="$(GNUSTEP_LIBRARIES)/$(GNUSTEP_TARGET_LDIR)/" -NONFHS_LIBNAME="$(LIBRARY_NAME)$(LIBRARY_NAME_SUFFIX)$(SHARED_LIBEXT)" -NONFHS_BINDIR="$(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)" - - -fhs-header-dirs :: - $(MKDIRS) $(FHS_INCLUDE_DIR)$(libWOXML_HEADER_FILES_INSTALL_DIR) - - -move-headers-to-fhs :: fhs-header-dirs - @echo "moving headers to $(FHS_INCLUDE_DIR) .." - mv $(GNUSTEP_HEADERS)$(libWOXML_HEADER_FILES_INSTALL_DIR)/*.h \ - $(FHS_INCLUDE_DIR)$(libWOXML_HEADER_FILES_INSTALL_DIR)/ - -move-libs-to-fhs :: - @echo "moving libs to $(FHS_LIB_DIR) .." - mv $(NONFHS_LIBDIR)/$(NONFHS_LIBNAME)* $(FHS_LIB_DIR)/ - -move-tools-to-fhs :: fhs-bin-dirs - @echo "moving tools from $(NONFHS_BINDIR) to $(FHS_BIN_DIR) .." - for i in $(TOOL_NAME); do \ - mv "$(NONFHS_BINDIR)/$${i}" $(FHS_BIN_DIR); \ - done - -move-to-fhs :: move-headers-to-fhs move-libs-to-fhs - -after-install :: move-to-fhs - -endif ============================================================ --- sope-core/EOControl/EOKeyValueCoding.m bba69aff42bf2cfe351e9f80ec3b6b14ce8bd35a +++ sope-core/EOControl/EOKeyValueCoding.m d767115c5d13fb624c1539a494784e306e50cabf @@ -24,10 +24,17 @@ #include "common.h" #if GNU_RUNTIME -# include + +#if __GNU_LIBOBJC__ == 20100911 +# define sel_get_any_uid sel_getUid +# include +#else # include +# include #endif +#endif + static EONull *null = nil; #if LIB_FOUNDATION_LIBRARY ============================================================ --- sope-core/EOControl/EOValidation.m 04000f0ed6c6e9ded5250c01ee6ea098241b5209 +++ sope-core/EOControl/EOValidation.m ede5fb08ebc5632ee82f623db062870e065b9b80 @@ -24,6 +24,10 @@ #include "EONull.h" #include "common.h" +#if __GNU_LIBOBJC__ == 20100911 +# define sel_get_any_uid sel_getUid +#endif + #if !LIB_FOUNDATION_LIBRARY @interface NSException(UsedSetUI) /* does Jaguar allow -setUserInfo: ? */ ============================================================ --- sope-core/NGExtensions/EOExt.subproj/EOQualifier+CtxEval.m 3381d0eff8fa5a6eba3643768f74e22913fdafb7 +++ sope-core/NGExtensions/EOExt.subproj/EOQualifier+CtxEval.m 3e1ff61981b7b80fb4accdecfeaac668f32072d7 @@ -29,7 +29,12 @@ # import # import #elif GNUSTEP_BASE_LIBRARY +#if __GNU_LIBOBJC__ == 20100911 +# define sel_get_name sel_getName +# import +#else # import +#endif #else # import # define sel_get_name sel_getName ============================================================ --- sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m f466960bd8081b8971bb16a221bfcbc348604096 +++ sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m 53462c1d9ee5ecb4c97c13e24025a978deb77f78 @@ -23,9 +23,13 @@ #include "common.h" #if LIB_FOUNDATION_LIBRARY || GNUSTEP_BASE_LIBRARY +#if __GNU_LIBOBJC__ == 20100911 +# include +#else # include # include # include +#endif # ifndef GNUSTEP # import # endif ============================================================ --- sope-core/NGExtensions/GNUmakefile 8dd7a334c7b73672ff38ff8be84923149b843ddb +++ sope-core/NGExtensions/GNUmakefile 2c182470b4121f06dcbc929696431eef65a7060a @@ -36,7 +36,6 @@ libNGExtensions_HEADER_FILES = \ NGHashMap.h \ NGMemoryAllocation.h \ NGMerging.h \ - NGObjCRuntime.h \ NGQuotedPrintableCoding.h \ NGStack.h \ NGObjectMacros.h \ @@ -56,7 +55,6 @@ libNGExtensions_OBJC_FILES = \ NGFileManagerURL.m \ NGHashMap.m \ NGMerging.m \ - NGObjCRuntime.m \ NGQuotedPrintableCoding.m \ NGStack.m \ NGCalendarDateRange.m \ ============================================================ --- sope-core/NGExtensions/NGBundleManager.m f97319022fb34cab745941d579d97800dd174feb +++ sope-core/NGExtensions/NGBundleManager.m afdb978b26102d2324760ad3249682c65e823172 @@ -28,11 +28,6 @@ #import #include -#if 0 && GNUSTEP_BASE_LIBRARY /* supported in repository since 19990916-2254-MET */ -/* hack until GNUstep provides the necessary callbacks */ -# define NSNonRetainedObjectMapValueCallBacks NSObjectMapValueCallBacks -#endif - #if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY # include #endif @@ -2010,7 +2005,11 @@ static BOOL debugLanguageLookup = NO; sprintf (buffer, "<%s %p fullPath: %s infoDictionary: %p loaded=%s>", +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + (char*)class_getName([self class]), +#else (char*)object_get_class_name(self), +#endif self, [[self bundlePath] cString], [self infoDictionary], ============================================================ --- sope-core/NGExtensions/NGExtensions/NGMemoryAllocation.h a31672ff89829a2c2c04db50365765b613386015 +++ sope-core/NGExtensions/NGExtensions/NGMemoryAllocation.h 8eb6eb8e3bc0fcce9b21576022c1d85887f6af3e @@ -22,7 +22,10 @@ #ifndef __NGExtensions_NGMemoryAllocation_H__ #define __NGExtensions_NGMemoryAllocation_H__ +#if __GNU_LIBOBJC__ != 20100911 #include +#endif + #include #if LIB_FOUNDATION_BOEHM_GC ============================================================ --- sope-core/NGExtensions/NGExtensions/NGObjCRuntime.h ba653518090f20a7f73063099dee683990ffee33 +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#ifndef __NGExtensions_NGObjCRuntime_H__ -#define __NGExtensions_NGObjCRuntime_H__ - -#import - -@class NSString, NSArray, NSEnumerator; - -@interface NSObject(NGObjCRuntime) - -/* retrieving additional class info */ - -+ (unsigned)instanceSize; - -/* adding methods to a class */ - -+ (void)addMethods:(SEL)_selector, ...; -+ (void)addClassMethods:(SEL)_selector, ...; - -+ (NSEnumerator *)methodNameEnumerator; -+ (NSEnumerator *)hierachyMethodNameEnumerator; - -/* making a subclass of a class */ - -+ (Class)subclass:(NSString *)_className ivars:(NSString *)_name1,...; - -/* instance variables */ - -+ (NSArray *)instanceVariableNames; -+ (NSArray *)allInstanceVariableNames; -+ (BOOL)hasInstanceVariableWithName:(NSString *)_ivarName; -+ (NSString *)signatureOfInstanceVariableWithName:(NSString *)_ivarName; -+ (unsigned)offsetOfInstanceVariableWithName:(NSString *)_ivarName; - -@end - -#endif /* __NGExtensions_NGObjCRuntime_H__ */ ============================================================ --- sope-core/NGExtensions/NGObjCRuntime.m 7865a052bb99165f8e2a7c5b3e36a667d4f0cf1d +++ /dev/null @@ -1,895 +0,0 @@ -/* - Copyright (C) 2000-2005 SKYRIX Software AG - - This file is part of SOPE. - - SOPE is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - SOPE is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with SOPE; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ - -#include "NGObjCRuntime.h" -#include "NGMemoryAllocation.h" -#include -#include -#include -#include "common.h" - -#if NeXT_RUNTIME || APPLE_RUNTIME -# include -# include -typedef struct objc_method_list *MethodList_t; -typedef struct objc_ivar_list *IvarList_t; -typedef struct objc_method *Method_t; -#else -# include -#endif - -#import -#import -#import -#import -#import - -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -@interface _NGMethodNameEnumerator : NSEnumerator -{ - Class clazz; - BOOL includeSuperclassMethods; - NSMutableSet *names; - - struct objc_method_list *methods; // current method list - unsigned i; // current index in current method list -#if APPLE_RUNTIME || NeXT_RUNTIME - void *iter; // runtime iterator -#endif -} - -- (id)initWithClass:(Class)_clazz includeSuperclassMethods:(BOOL)_flag; -- (id)nextObject; - -@end - -#if NeXT_RUNTIME || APPLE_RUNTIME - -static __inline__ unsigned NGGetSizeOfType(char *ivarType) { - // TODO: add more types ... - switch (*ivarType) { - /* the Apple runtime has no func to calc a type size ?! */ - case '@': return sizeof(id); - case ':': return sizeof(SEL); - case 'c': return sizeof(signed char); - case 's': return sizeof(signed short); - case 'i': return sizeof(signed int); - case 'C': return sizeof(unsigned char); - case 'S': return sizeof(unsigned short); - case 'I': return sizeof(unsigned int); - default: return 0xDEAFBEAF; - } -} - -#endif - -@implementation NSObject(NGObjCRuntime) - -static NSArray *emptyArray = nil; - -static unsigned countMethodSpecs(SEL _selector, va_list *va) - __attribute__((unused)); - -static unsigned countMethodSpecs(SEL _selector, va_list *va) { - SEL selector; - NSString *signature; - IMP imp; - unsigned count; - - selector = _selector; - signature = nil; - imp = NULL; - if (selector) signature = va_arg(*va, id); - if (signature) imp = va_arg(*va, IMP); - - count = 0; - while ((selector != NULL) && (signature != nil) && (imp != NULL)) { - count++; - - if ((selector = va_arg(*va, SEL)) == NULL) break; - if ((signature = (id)va_arg(*va, NSString *)) == nil) break; - if ((imp = (IMP)va_arg(*va, IMP)) == NULL) break; - } - return count; -} - -static void -fillMethodListWithSpecs(MethodList_t methods, SEL _selector, va_list *va) -{ - /* takes triple: SEL, signature, IMP */ - SEL selector; - NSString *signature; - IMP imp; - unsigned count; - - selector = _selector; - signature = selector ? va_arg(*va, NSString *) : (NSString *)nil; - imp = signature ? va_arg(*va, IMP) : NULL; - count = 0; - while ((selector != NULL) && (signature != nil) && (imp != NULL)) { - unsigned len; - char *types; -#if GNU_RUNTIME - const char *selname; -#endif - - /* allocate signature buffer */ - len = [signature cStringLength]; - types = malloc(len + 4); - [signature getCString:types]; - types[len] = 0; - -#if APPLE_RUNTIME || NeXT_RUNTIME - count = methods->method_count; - methods->method_list[count].method_name = selector; - methods->method_list[count].method_types = types; - methods->method_list[count].method_imp = imp; - methods->method_count++; -#else - /* determine selector name */ - selname = sel_get_name(selector); - - /* fill structure */ - methods->method_list[count].method_name = (SEL)selname; - methods->method_list[count].method_types = types; - methods->method_list[count].method_imp = imp; - count++; -#endif - - /* go to next method spec */ - if ((selector = va_arg(*va, SEL)) == NULL) break; - if ((signature = va_arg(*va, NSString *)) == nil) break; - if ((imp = va_arg(*va, IMP)) == NULL) break; - } -#if GNU_RUNTIME - methods->method_count = count; - methods->method_next = NULL; -#endif -} - -+ (unsigned)instanceSize { - return ((Class)self)->instance_size; -} - -/* adding methods */ - -+ (void)addMethodList:(MethodList_t)_methods { - if (_methods == NULL) return; - if (_methods->method_count == 0) return; - -#if NeXT_RUNTIME - class_addMethods(self, _methods); -#else - { - extern void class_add_method_list (Class class, MethodList_t list); - class_add_method_list(self, _methods); - } -#endif -} - -+ (void)addClassMethodList:(MethodList_t)_methods { - if (_methods == NULL) return; - if (_methods->method_count == 0) return; -#if NeXT_RUNTIME - class_addMethods(((Class)self)->isa, _methods); -#else - { - extern void class_add_method_list (Class class, MethodList_t list); - class_add_method_list(((Class)self)->class_pointer, _methods); - } -#endif -} - -+ (void)addMethods:(SEL)_selector, ... { - /* takes triples (sel, type, imp) finished by nil */ - MethodList_t methods; - va_list va; - unsigned count; - - va_start(va, _selector); - count = countMethodSpecs(_selector, &va); - va_end(va); - if (count == 0) return; - -#if NeXT_RUNTIME || APPLE_RUNTIME - methods = malloc(sizeof(struct objc_method_list) + - ((count + 1) * sizeof(struct objc_method))); - methods->method_count = 0; - - va_start(va, _selector); - fillMethodListWithSpecs(methods, _selector, &va); - va_end(va); - - [self addMethodList:methods]; -#else - methods = malloc(sizeof(MethodList) + (count + 2) * sizeof(Method)); - NSAssert(methods, @"could not allocate methodlist"); - - va_start(va, _selector); - fillMethodListWithSpecs(methods, _selector, &va); - va_end(va); - - [self addMethodList:methods]; -#endif -} - -+ (void)addClassMethods:(SEL)_selector, ... { - /* takes triples finished by nil */ - MethodList_t methods; - va_list va; - unsigned count; - - va_start(va, _selector); - count = countMethodSpecs(_selector, &va); - va_end(va); - if (count == 0) return; - -#if NeXT_RUNTIME - methods = malloc(sizeof(struct objc_method_list) + - ((count + 1) * sizeof(struct objc_method))); - methods->method_count = 0; - - va_start(va, _selector); - fillMethodListWithSpecs(methods, _selector, &va); - va_end(va); - - [self addClassMethodList:methods]; -#else - methods = malloc(sizeof(MethodList) + count * sizeof(Method)); - NSAssert(methods, @"couldn't allocate methodlist"); - - va_start(va, _selector); - fillMethodListWithSpecs(methods, _selector, &va); - va_end(va); - - [self addClassMethodList:methods]; -#endif -} - -+ (NSEnumerator *)methodNameEnumerator { - return [[[_NGMethodNameEnumerator alloc] - initWithClass:self - includeSuperclassMethods:NO] - autorelease]; -} -+ (NSEnumerator *)hierachyMethodNameEnumerator { - return [[[_NGMethodNameEnumerator alloc] - initWithClass:self - includeSuperclassMethods:YES] - autorelease]; -} - -/* subclassing */ - -+ (Class)subclass:(NSString *)_className - ivarsList:(IvarList_t)_ivars -{ -#if NeXT_RUNTIME - [(NSObject *)self doesNotRecognizeSelector:_cmd]; - return Nil; -#else - // TODO: do we really need a symtab? PyObjC does not seem to require that - Module_t module; - Class newMetaClass, newClass; - unsigned nameLen; - char *name, *moduleName, *metaName; - int instanceSize, i; - - /* define names */ - - nameLen = [_className cStringLength]; - name = malloc(nameLen + 3); - [_className getCString:name]; - - moduleName = name; - metaName = name; - - /* calc instance size */ - - // printf("calc isize ..\n"); - - for (i = 0, instanceSize = ((Class)self)->instance_size; - i < _ivars->ivar_count; i++) { - unsigned typeAlign, typeLen; - - // printf("ivar %s\n", _ivars->ivar_list[i].ivar_name); - // printf(" type %s\n", _ivars->ivar_list[i].ivar_type); - - typeAlign = objc_alignof_type(_ivars->ivar_list[i].ivar_type); - typeLen = objc_sizeof_type(_ivars->ivar_list[i].ivar_type); - - /* check if offset is aligned */ - if ((instanceSize % typeAlign) != 0) { - /* add alignment size */ - instanceSize += (typeAlign - (instanceSize % typeAlign)); - } - instanceSize += typeLen; - } - - /* allocate structures */ - - newMetaClass = malloc(sizeof(struct objc_class)); - newClass = malloc(sizeof(struct objc_class)); - NSCAssert(newMetaClass, @"could not allocate new meta class structure"); - NSCAssert(newClass, @"could not allocate new class structure"); - - // printf("setup meta ..\n"); - - /* init meta class */ - newMetaClass->super_class = (Class)((Class)self)->class_pointer->name; - newMetaClass->class_pointer = newMetaClass->super_class->class_pointer; - newMetaClass->name = metaName; - newMetaClass->version = 0; - newMetaClass->info = _CLS_META; - newMetaClass->instance_size = newMetaClass->super_class->instance_size; - newMetaClass->methods = NULL; - newMetaClass->dtable = NULL; - newMetaClass->subclass_list = NULL; - newMetaClass->sibling_class = NULL; - newMetaClass->protocols = NULL; - newMetaClass->gc_object_type = NULL; - - // printf("setup class ..\n"); - /* init class */ - newClass->super_class = (Class)((Class)self)->name; - newClass->class_pointer = newMetaClass; - newClass->name = name; - newClass->version = 0; - newClass->info = _CLS_CLASS; - newClass->instance_size = instanceSize; - newClass->methods = NULL; - newClass->dtable = NULL; - newClass->subclass_list = NULL; - newClass->sibling_class = NULL; - newClass->protocols = NULL; - newClass->gc_object_type = NULL; - newClass->ivars = _ivars; - - /* allocate module */ - - module = malloc(sizeof(Module)); - NSCAssert(module, @"could not allocate module !"); - memset(module, 0, sizeof(Module)); - module->version = 8; - module->size = sizeof(Module); - module->name = moduleName; - - /* allocate symtab with one entry */ - module->symtab = malloc(sizeof(Symtab) + (2 * sizeof(void *))); - module->symtab->sel_ref_cnt = 0; - module->symtab->refs = 0; // ptr to array of 'struct objc_selector' - module->symtab->cls_def_cnt = 1; - module->symtab->cat_def_cnt = 0; - module->symtab->defs[0] = newClass; - module->symtab->defs[1] = NULL; - - /* execute module */ - { -#if GCC_VERSION < 30400 - extern void __objc_exec_class(Module_t module); // is thread-safe - extern void __objc_resolve_class_links(); -#else - void __objc_exec_class(void* module); - void __objc_resolve_class_links(); -#endif - - /* - This is the main entry function in the GNU runtime. It does a LOT of - work, including the setup of global hashes if missing. Some things (like - the global hashes) are not relevant for us, since the runtime itself is - already up. - This function uses the internal lock for runtime modifications. - - The method does with the runtime lock applied (2.95.3): - - setup globals - - registers typed selectors for symtab->refs - - walks over all classes - - adds the class to the hash - - registers the selectors of the class - - registers the selectors of the metaclass - - install dtable's (just assigns NULL?) - - registers instance methods as class methods for root classes - - inits protocols - - add superclasses to unresolved-classes - - walks over all categories - - register uninitialized statics - - walk over unclaimed categories - - walk over unclaimed protocols - - send the +load message - - Actually this function just calls __objc_exec_module(), don't know why - we call this one instead. - */ - // printf("execute class\n"); - __objc_exec_class(module); - - //printf("resolve links\n"); - __objc_resolve_class_links(); - } - - return NSClassFromString(_className); -#endif -} - -+ (Class)subclass:(NSString *)_className - ivarNames:(NSString **)_ivarNames - ivarTypes:(NSString **)_ivarTypes - ivarCount:(unsigned)ivarCount -{ - unsigned currentSize; - - currentSize = ((Class)self)->instance_size; - -#if NeXT_RUNTIME || APPLE_RUNTIME - { - /* some tricks for Apple inspired by PyObjC, long live OpenSource ;-) */ - IvarList_t ivars; - struct objc_class *clazz; - struct objc_class *metaClazz; - struct objc_class *rootClazz; - - /* build ivars */ - - ivars = NULL; - if (ivarCount > 0) { - unsigned i; - - ivars = calloc(sizeof(struct objc_ivar_list) + - (ivarCount) * sizeof(struct objc_ivar), sizeof(char)); - - for (i = 0; i < ivarCount; i++) { - NSString *n, *t; - Ivar var; - char *ivarName, *ivarType; - int ivarOffset; - unsigned len, typeAlign, typeLen; - - n = _ivarNames[i]; - t = _ivarTypes[i]; - - len = [n cStringLength]; - ivarName = malloc(len + 2); - [n getCString:ivarName]; - ivarName[len] = '\0'; - - len = [t cStringLength]; - ivarType = malloc(len + 2); - [t getCString:ivarType]; - ivarType[len] = '\0'; - - /* calc ivarOffset */ - typeAlign = 0; // TODO: alignment?! - - typeLen = NGGetSizeOfType(ivarType); - NSAssert1(typeLen != 0xDEAFBEAF, - @"does not support ivars of type '%s'", ivarType); - ivarOffset = currentSize; - - var = ivars->ivar_list + ivars->ivar_count; - ivars->ivar_count++; - - var->ivar_name = ivarName; - var->ivar_offset = ivarOffset; - var->ivar_type = ivarType; - - /* adjust current size */ - currentSize = ivarOffset + typeLen; - } - } - - // TODO: move the following to a subclass method - - /* determine root class */ - - for (rootClazz = self; rootClazz->super_class != NULL; ) - rootClazz = rootClazz->super_class; - - /* setup meta class */ - - metaClazz = calloc(1, sizeof(struct objc_class)); - metaClazz->isa = rootClazz->isa; // root-meta is the metameta - metaClazz->name = strdup([_className cString]); - metaClazz->info = CLS_META; - metaClazz->super_class = ((struct objc_class *)self)->isa; - metaClazz->instance_size = ((struct objc_class *)self)->isa->instance_size; - metaClazz->ivars = NULL; - metaClazz->protocols = NULL; - - /* setup class */ - - clazz = calloc(1, sizeof(struct objc_class)); - clazz->isa = metaClazz; /* hook up meta class */ - clazz->name = strdup([_className cString]); - clazz->info = CLS_CLASS; - clazz->super_class = self; - clazz->instance_size = currentSize; - clazz->ivars = ivars; - clazz->protocols = NULL; - -#if 0 - NSLog(@"instance size: %d, ivar-count: %d", - currentSize, ivars->ivar_count); -#endif - - /* setup method lists */ - - metaClazz->methodLists = calloc(1, sizeof(struct objc_method_list *)); - clazz->methodLists = calloc(1, sizeof(struct objc_method_list *)); - - /* Note: MacOSX specific, Radar #3317376, hint taken from PyObjC */ - metaClazz->methodLists[0] = (struct objc_method_list *)-1; - clazz->methodLists[0] = (struct objc_method_list *)-1; - - /* add to runtime (according to PyObjC not reversible?) */ - objc_addClass(clazz); - return NSClassFromString(_className); - } -#else - { - unsigned i; - IvarList_t ivars; - - ivars = malloc(sizeof(IvarList) + (sizeof(struct objc_ivar) * ivarCount)); - ivars->ivar_count = ivarCount; - - for (i = 0; i < ivarCount; i++) { - NSString *n, *t; - char *ivarName, *ivarType; - int ivarOffset; - unsigned len, typeAlign, typeLen; - - n = _ivarNames[i]; - t = _ivarTypes[i]; - - len = [n cStringLength]; - ivarName = malloc(len + 2); - [n getCString:ivarName]; - ivarName[len] = '\0'; - - len = [t cStringLength]; - ivarType = malloc(len + 2); - [t getCString:ivarType]; - ivarType[len] = '\0'; - - /* calc ivarOffset */ - typeAlign = objc_alignof_type(ivarType); - typeLen = objc_sizeof_type(ivarType); - ivarOffset = currentSize; - - /* check if offset is aligned */ - if ((ivarOffset % typeAlign) != 0) { - /* align offset */ - len = (typeAlign - (ivarOffset % typeAlign)); - ivarOffset += len; - } - - /* adjust current size */ - currentSize = ivarOffset + typeLen; - - ivars->ivar_list[ivarCount].ivar_name = ivarName; - ivars->ivar_list[ivarCount].ivar_type = ivarType; - ivars->ivar_list[ivarCount].ivar_offset = ivarOffset; - } - - return [self subclass:_className ivarsList:ivars]; - } -#endif -} - -+ (Class)subclass:(NSString *)_className - ivars:(NSString *)_name1,... -{ - va_list va; /* contains: name1, type1, name2, type2, ... */ - unsigned ivarCount; - NSString *n, *t; - NSString **ivarNames = NULL; - NSString **ivarTypes = NULL; - Class clazz; - - /* determine number of args */ - - va_start(va, _name1); - for (n = _name1, t = va_arg(va, NSString *), ivarCount = 0; - (n != nil && t != nil); - n = va_arg(va, NSString *), t = va_arg(va, NSString *)) - ivarCount++; - va_end(va); - - /* collect args */ - - if (ivarCount > 0) { - ivarNames = calloc(ivarCount, sizeof(NSString *)); - ivarTypes = calloc(ivarCount, sizeof(NSString *)); - va_start(va, _name1); - for (n = _name1, t = va_arg(va, NSString *), ivarCount = 0; - (n != nil && t != nil); - n = va_arg(va, NSString *), t = va_arg(va, NSString *)) { - ivarNames[ivarCount] = n; - ivarTypes[ivarCount] = t; - ivarCount++; - } - va_end(va); - } - - /* call primary method */ - - clazz = [self subclass:_className - ivarNames:ivarNames ivarTypes:ivarTypes ivarCount:ivarCount]; - - if (ivarNames != NULL) free(ivarNames); - if (ivarTypes != NULL) free(ivarTypes); - return clazz; -} - -/* instance variables */ - -+ (NSArray *)instanceVariableNames { - NSArray *result; - NSString **names; - int i; - - if (((Class)self)->ivars == NULL || ((Class)self)->ivars->ivar_count == 0) { - if (emptyArray == nil) emptyArray = [[NSArray alloc] init]; - return emptyArray; - } - - names = calloc(((Class)self)->ivars->ivar_count + 2, sizeof(NSString *)); - - for (i = 0; i < ((Class)self)->ivars->ivar_count; i++) { - register unsigned char *ivarName; - - ivarName = (void *)(((Class)self)->ivars->ivar_list[i].ivar_name); - if (ivarName == NULL) { - NSLog(@"WARNING(%s): ivar without name! (idx=%d)", - __PRETTY_FUNCTION__, i); - continue; - } - -#if !LIB_FOUNDATION_LIBRARY - names[i] = [NSString stringWithCString:(char *)ivarName]; -#else - names[i] = [NSString stringWithCStringNoCopy:(char *)ivarName - freeWhenDone:NO]; -#endif - } - - result = [NSArray arrayWithObjects:names - count:((Class)self)->ivars->ivar_count]; - if (names) free(names); - return result; -} -+ (NSArray *)allInstanceVariableNames { - NSMutableArray *varNames; - Class c; - - varNames = [NSMutableArray arrayWithCapacity:32]; - for (c = self; c != Nil; c = [c superclass]) - [varNames addObjectsFromArray:[c instanceVariableNames]]; - - return [[varNames copy] autorelease]; -} - -+ (BOOL)hasInstanceVariableWithName:(NSString *)_ivarName { - Class c; - unsigned len = [_ivarName cStringLength]; - char *ivarName; - - if (len == 0) - return NO; - - ivarName = malloc(len + 1); - [_ivarName getCString:ivarName]; ivarName[len] = '\0'; - - for (c = self; c != Nil; c = [c superclass]) { - int i; - - for (i = 0; i < c->ivars->ivar_count; i++) { - if (strcmp(ivarName, c->ivars->ivar_list[i].ivar_name) == 0) { - free(ivarName); - return YES; - } - } - } - free(ivarName); - return NO; -} - -+ (NSString *)signatureOfInstanceVariableWithName:(NSString *)_ivarName { - Class c; - unsigned len = [_ivarName cStringLength]; - char *ivarName; - - if (len == 0) - return nil; - - ivarName = malloc(len + 1); - [_ivarName getCString:ivarName]; ivarName[len] = '\0'; - - for (c = self; c != Nil; c = [c superclass]) { - int i; - - for (i = 0; i < c->ivars->ivar_count; i++) { - if (strcmp(ivarName, c->ivars->ivar_list[i].ivar_name) == 0) { - /* found matching ivar name */ - if (ivarName) free(ivarName); -#if !LIB_FOUNDATION_LIBRARY - return [NSString stringWithCString: - (char *)(c->ivars->ivar_list[i].ivar_type)]; -#else - return [NSString stringWithCStringNoCopy: - (char *)(c->ivars->ivar_list[i].ivar_type) - freeWhenDone:NO]; -#endif - } - } - } - if (ivarName) free(ivarName); - return nil; -} - - -+ (unsigned)offsetOfInstanceVariableWithName:(NSString *)_ivarName { - Class c; - unsigned len = [_ivarName cStringLength]; - char *ivarName; - - if (len == 0) - return NSNotFound; - - ivarName = malloc(len + 3); - [_ivarName getCString:ivarName]; ivarName[len] = '\0'; - - for (c = self; c != Nil; c = [c superclass]) { - int i; - - for (i = 0; i < c->ivars->ivar_count; i++) { - if (strcmp(ivarName, c->ivars->ivar_list[i].ivar_name) == 0) { - /* found matching ivar name */ - free(ivarName); - return c->ivars->ivar_list[i].ivar_offset; - } - } - } - free(ivarName); - return NSNotFound; -} - -@end /* NSObject(NGObjCRuntime) */ - -@implementation _NGMethodNameEnumerator - -- (id)initWithClass:(Class)_clazz includeSuperclassMethods:(BOOL)_flag { - if (_clazz == Nil) { - [self release]; - return nil; - } - - self->names = [[NSMutableSet alloc] initWithCapacity:200]; - self->clazz = _clazz; - self->includeSuperclassMethods = _flag; - -#if NeXT_RUNTIME - self->iter = 0; - self->methods = class_nextMethodList(self->clazz, &(self->iter)); -#else - self->methods = _clazz->methods; - self->i = 0; -#endif - return self; -} - -- (void)dealloc { - [self->names release]; - [super dealloc]; -} - -- (id)nextObject { - if (self->clazz == nil) - return nil; - - if (self->methods == NULL) { - /* methods of current class are done .. */ - if (!self->includeSuperclassMethods) - return nil; - - /* loop, maybe there are classes without a method-list ? */ - while (self->methods == NULL) { - if ((self->clazz = [self->clazz superclass]) == Nil) - /* no more superclasses */ - return nil; - -#if NeXT_RUNTIME - self->iter = 0; - self->methods = class_nextMethodList(self->clazz, &(self->iter)); -#else - self->methods = self->clazz->methods; -#endif - } - self->i = 0; - } - -#if DEBUG - NSAssert(self->methods, @"missing method-list !"); -#endif - - while (self->i >= (unsigned)self->methods->method_count) { -#if NeXT_RUNTIME || APPLE_RUNTIME - self->methods = class_nextMethodList(self->clazz, &(self->iter)); -#else - self->methods = self->methods->method_next; -#endif - if (self->methods == NULL) - break; - self->i = 0; - } - - if (self->methods == NULL) { - /* recurse to next super class */ - return self->includeSuperclassMethods - ? [self nextObject] - : nil; - } - - /* get name .. */ - { - Method_t m; - NSString *name; - - m = &(self->methods->method_list[self->i]); - self->i++; - - NSAssert(m, @"missing method structure !"); - name = NSStringFromSelector(m->method_name); - NSAssert(name, @"couldn't get method name !"); - - if ([self->names containsObject:name]) { - /* this name was already delivered from a subclass, take next */ - return [self nextObject]; - } - - [self->names addObject:name]; - - return name; - } -} - -@end /* _NGMethodNameEnumerator */ - -#if GNU_RUNTIME - -@interface NGObjCClassEnumerator : NSEnumerator -{ - void *state; -} -@end - -@implementation NGObjCClassEnumerator - -- (id)nextObject { - return objc_next_class(&(self->state)); -} - -@end /* NGObjCClassEnumerator */ - -#endif /* GNU_RUNTIME */ ============================================================ --- sope-core/NGExtensions/common.h c7c29acc9cd3927149f595438f2666dfa2252814 +++ sope-core/NGExtensions/common.h 819ac09f20d4c77e1f9bdcf21e2bf9368d59a8ba @@ -41,10 +41,14 @@ #endif #if GNU_RUNTIME +#if __GNU_LIBOBJC__ == 20100911 +# include +#else # import # import # import #endif +#endif #if LIB_FOUNDATION_LIBRARY # include ============================================================ --- sope-core/NGStreams/NGConcreteStreamFileHandle.m 7acc98f9176b583bbbea1fb779d8a72e22996c8c +++ sope-core/NGStreams/NGConcreteStreamFileHandle.m dcdb0d9d9c00888298d45d62f1a5e4c4c4ba08bd @@ -19,7 +19,6 @@ 02111-1307, USA. */ -#include #include #include #include ============================================================ --- sope-core/NGStreams/common.h d5ec051b757107643a3e9a84ab40071412e9a4a1 +++ sope-core/NGStreams/common.h 6b3c6a2bb8aa5769aa7672be129daa8d958deed1 @@ -40,10 +40,14 @@ #endif #ifdef GNU_RUNTIME +#if __GNU_LIBOBJC__ == 20100911 +# include +#else # include # include # include #endif +#endif #if WITH_FOUNDATION_EXT #if NeXT_Foundation_LIBRARY || APPLE_Foundation_LIBRARY ============================================================ --- sope-core/PROJECTLEAD 8a7fbe37de2808c9a519a7b8f348e1399e280d38 +++ /dev/null @@ -1 +0,0 @@ -PROJECTLEAD=helge.hess@opengroupware.org ============================================================ --- sope-gdl1/GDLAccess/EODatabaseFault.m cbed5c05d66f16f9836a66c3bcf941abfccd98fb +++ sope-gdl1/GDLAccess/EODatabaseFault.m 39a385b41e25a05b2c6de3db4812b695f0246db9 @@ -66,15 +66,22 @@ typedef struct { if (fault == nil) return nil; - - if ([fault class]->instance_size < ((Class)self)->instance_size) { +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + if (class_getInstanceSize([fault class]) < class_getInstanceSize([self class])) { +#else + if ([fault class]->instance_size < ((Class)self)->instance_size) { +#endif [fault autorelease]; [NSException raise:NSInvalidArgumentException format: @"Instances from class %@ must be at least %d in size " @"to fault", - NSStringFromClass([fault class]), - ((Class)self)->instance_size]; + NSStringFromClass([fault class]), +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + class_getInstanceSize([self class])]; +#else + ((Class)self)->instance_size]; +#endif } fault->faultResolver = [[EOObjectFault alloc] initWithPrimaryKey:key entity:entity databaseChannel:channel zone:zone @@ -125,14 +132,22 @@ typedef struct { fault = [NSMutableArray allocWithZone:zone]; +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + if (class_getInstanceSize([fault class]) < class_getInstanceSize([self class])) { +#else if ([fault class]->instance_size < ((Class)(self))->instance_size) { +#endif (void)[fault autorelease]; [NSException raise:NSInvalidArgumentException format: @"Instances from class %s must be at least %d " @"in size to fault", NSStringFromClass([fault class]), - ((Class)self)->instance_size]; +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + class_getInstanceSize([self class])]; +#else + ((Class)self)->instance_size]; +#endif } fault->faultResolver = [[EOArrayFault alloc] initWithQualifier:qualifier fetchOrder:fetchOrder databaseChannel:channel zone:zone ============================================================ --- sope-gdl1/GDLAccess/EOFault.m 653f0d9bb856121471340b41842a46bdc5239bde +++ sope-gdl1/GDLAccess/EOFault.m 48205793ddd1c54063e556c73bfe296bb5e08ab4 @@ -38,15 +38,26 @@ typedef struct { Class isa; } *my_objc_object; -#if GNU_RUNTIME +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# warning TODO: implement for NeXT/Apple runtime! +# define object_is_instance(object) (object!=nil?YES:NO) +# define class_get_super_class class_getSuperclass +# define class_get_class_method class_getClassMethod +# define class_get_instance_method class_getInstanceMethod +# define METHOD_NULL NULL +typedef struct objc_method *Method_t; +#else # define object_is_instance(object) \ ((object!=nil)&&CLS_ISCLASS(((my_objc_object)object)->isa)) -#else -# warning TODO: implement for NeXT/Apple runtime! +#endif + +#if __GNU_LIBOBJC__ == 20100911 +# define METHOD_NULL NULL +# define class_get_super_class class_getSuperclass # define object_is_instance(object) (object!=nil?YES:NO) +typedef struct objc_method *Method_t; #endif - /* * EOFault class */ @@ -99,8 +110,12 @@ typedef struct { if (fault == nil) return NO; if (EOFaultClass == Nil) EOFaultClass = [EOFault class]; - + +#if defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) + for (clazz = ((EOFault *)fault)->isa; clazz; clazz = class_getSuperclass(clazz)) { +#else for (clazz = ((EOFault *)fault)->isa; clazz; clazz = clazz->super_class) { +#endif if (clazz == EOFaultClass) return YES; } @@ -335,6 +350,7 @@ static inline void _resolveFault(EOFault @end /* EOFault */ +#if 0 @implementation EOFault(RealForwarding) #if NeXT_Foundation_LIBRARY @@ -372,5 +388,5 @@ static inline void _resolveFault(EOFault #endif } #endif - @end /* EOFault(RealForwarding) */ +#endif // #if 0 ============================================================ --- sope-gdl1/GDLAccess/EOFaultHandler.m baa23bb8c785795617aa4229d4905ea70134d9a2 +++ sope-gdl1/GDLAccess/EOFaultHandler.m 2e2b559fdca27b14229dbe71a0b27d7f49a2bec9 @@ -29,12 +29,25 @@ #include "EOFault.h" #include "common.h" +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# define METHOD_NULL NULL +# define class_get_super_class class_getSuperclass +# define object_is_instance(object) (object!=nil?YES:NO) +# define class_get_instance_method class_getInstanceMethod +typedef struct objc_method *Method_t; +#endif + #if NeXT_RUNTIME # if !defined(METHOD_NULL) # define METHOD_NULL NULL # endif #endif +#if defined (__GNUSTEP_RUNTIME__) +# define class_get_instance_method class_getInstanceMethod +#endif + + @implementation EOFaultHandler - (void)setTargetClass:(Class)_class extraData:(void *)_extraData { @@ -65,7 +78,9 @@ /* fault reflection */ - (Class)classForFault:(EOFault *)_fault { -#if GNU_RUNTIME + +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) + return (object_is_instance(_fault)) ? [self targetClass] : (*(Class *)_fault); @@ -79,7 +94,7 @@ Class class; /* first check whether fault itself responds to selector */ -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) if (class_get_instance_method(*(Class *)_fault, _selector) != METHOD_NULL) return YES; #else @@ -88,7 +103,7 @@ /* then check whether the target class does */ class = [self targetClass]; -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) return (class_get_instance_method(class, _selector) != NULL) ? YES : NO; #else # warning TODO: use NeXT/Apple runtime function @@ -99,7 +114,7 @@ - (BOOL)conformsToProtocol:(Protocol *)_protocol forFault:(EOFault *)_fault { Class class, sClass; -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) && __GNU_LIBOBJC__ != 20100911 struct objc_protocol_list* protos; int i; @@ -123,7 +138,7 @@ - (BOOL)isKindOfClass:(Class)_class forFault:(EOFault *)_fault { Class class; -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) class = object_is_instance(_fault) ? [self targetClass] : (Class)_fault; for (; class != Nil; class = class_get_super_class(class)) { if (class == _class) @@ -138,7 +153,7 @@ - (BOOL)isMemberOfClass:(Class)_class forFault:(EOFault *)_fault { Class class; -#if GNU_RUNTIME +#if GNU_RUNTIME && !defined(__GNUSTEP_RUNTIME__) class = object_is_instance(_fault) ? [self targetClass] : (Class)_fault; #else # warning TODO: add implementation for NeXT/Apple runtime! @@ -150,7 +165,7 @@ - (NSMethodSignature *)methodSignatureForSelector:(SEL)_selector forFault:(EOFault *)_fault { -#if NeXT_Foundation_LIBRARY +#if NeXT_Foundation_LIBRARY || defined(__GNUSTEP_RUNTIME__) // probably incorrect return [_fault methodSignatureForSelector:_selector]; #else @@ -165,7 +180,8 @@ #endif /* first check for EOFault's own methods */ - + +#if __GNU_LIBOBJC__ != 20100911 if (types == NULL) { // lookup method for selector struct objc_method *mth; @@ -181,7 +197,8 @@ mth = class_get_instance_method([self targetClass], _selector); if (mth) types = mth->method_types; } - +#endif + #if GNU_RUNTIME // GNU runtime selectors may be typed, a lookup may not be necessary if (types == NULL) ============================================================ --- sope-gdl1/GDLAccess/EORecordDictionary.m 907d584d5417e00846b65684b034cb1501eadc41 +++ sope-gdl1/GDLAccess/EORecordDictionary.m e3f92f26a9a7773ef40d641b1de8623f911da1a1 @@ -39,6 +39,13 @@ # include #endif +#if (defined(__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ == 20100911)) || defined(APPLE_RUNTIME) || defined(__GNUSTEP_RUNTIME__) +# include +# define method_get_imp method_getImplementation +# define class_get_instance_method class_getInstanceMethod +#endif + + #include "EORecordDictionary.h" @implementation EORecordDictionary ============================================================ --- sope-gdl1/MySQL/NSString+MySQL4.m b0b35c8cf5110155c962aad827e71e83673b0cdf +++ sope-gdl1/MySQL/NSString+MySQL4.m 270f30168958bf5ae05d8c125d58ee1a309a96e0 @@ -29,7 +29,6 @@ #include "NSString+MySQL4.h" #include "common.h" -#import @implementation NSString(MySQL4MiscStrings) ============================================================ --- sope-gdl1/MySQL/common.h b1246826f15a7cda0b62dc019a9eb78f31100af9 +++ sope-gdl1/MySQL/common.h c1654dc67d3a84cf80b1b32ad6bf3dea4c735ec8 @@ -26,14 +26,10 @@ #ifndef ___MySQL4_common_H___ #define ___MySQL4_common_H___ -#import - #include #include #include -#import - #include #include ============================================================ --- sope-gdl1/PostgreSQL/NSString+PostgreSQL72.m 088585138a050cf18c0bcf77787c15910ba3b227 +++ sope-gdl1/PostgreSQL/NSString+PostgreSQL72.m 956f0d45aef537a11b0bacff9c15fde2c40d438b @@ -28,7 +28,6 @@ # include #endif -#import #include "common.h" #import "NSString+PostgreSQL72.h" ============================================================ --- sope-gdl1/PostgreSQL/common.h 888b0f01c640da66229d2c076600ae8e21103a5b +++ sope-gdl1/PostgreSQL/common.h dc9618421c17ede0dac292a84d593df6b42af914 @@ -27,14 +27,10 @@ #ifndef ___PostgreSQL_common_H___ #define ___PostgreSQL_common_H___ -#import - #include #include #include -#import - #if !LIB_FOUNDATION_LIBRARY # include # include ============================================================ --- sope-xml/PROJECTLEAD 8a7fbe37de2808c9a519a7b8f348e1399e280d38 +++ /dev/null @@ -1 +0,0 @@ -PROJECTLEAD=helge.hess@opengroupware.org ============================================================ --- ChangeLog 8eefb416ac4e53ccbf4214926a37e127d74f5d20 +++ ChangeLog e53079b05035e5f911bd48d753315ac44fbd6205 @@ -1,3 +1,11 @@ +2011-07-27 Ludovic Marcotte + + * Dropped useless stuff in SOPE + * Made sure everything would compile and work + on GCC's runtime (< 4.6 and >= 4.6) and the + GNUstep runtime (libobjc2-1.5). This is an initial effort + as things should still be cleaned up in SOPE. + 2011-07-18 Francis Lachapelle * NGUrlFormCoder.m (NGDecodeUrlFormParameters): applied a patch from