IOWA 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
data/src/iowa/DbPool.rb
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
require 'dbi'
|
|
2
|
+
require 'thread'
|
|
3
|
+
|
|
4
|
+
######################
|
|
5
|
+
##### DEPRECATED #####
|
|
6
|
+
######################
|
|
7
|
+
#
|
|
8
|
+
# This database connection pool has been deprecated.
|
|
9
|
+
# Take a look at the Iowa::Pool and Iowa::Pool::DBConnectionPool
|
|
10
|
+
# classes for a look at the way it will be in the future.
|
|
11
|
+
#
|
|
12
|
+
module Iowa
|
|
13
|
+
|
|
14
|
+
class ReInitException < Exception; end
|
|
15
|
+
class MissingConnectionException < Exception; end
|
|
16
|
+
|
|
17
|
+
CBEGIN = "BEGIN"
|
|
18
|
+
CCOMMIT = "COMMIT"
|
|
19
|
+
CROLLBACK = "ROLLBACK"
|
|
20
|
+
|
|
21
|
+
class DbPool
|
|
22
|
+
@monitorThread
|
|
23
|
+
@pool
|
|
24
|
+
@poolSize
|
|
25
|
+
|
|
26
|
+
attr_reader :host, :dbName
|
|
27
|
+
attr_reader :userName, :password, :monitorInterval
|
|
28
|
+
|
|
29
|
+
def make_singleton(conn)
|
|
30
|
+
class << conn
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
attr_accessor :parent
|
|
33
|
+
|
|
34
|
+
def freeConnection
|
|
35
|
+
parent.freeConnection(self)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
attr_accessor :transaction_depth
|
|
39
|
+
|
|
40
|
+
def begin_transaction
|
|
41
|
+
if @transaction_depth == 0
|
|
42
|
+
self.do(CBEGIN)
|
|
43
|
+
end
|
|
44
|
+
@transaction_depth += 1
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def commit_transaction
|
|
48
|
+
if @transaction_depth == 1
|
|
49
|
+
self.do(CCOMMIT)
|
|
50
|
+
end
|
|
51
|
+
@transaction_depth -= 1
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def rollback_transaction
|
|
55
|
+
if @transaction_depth == 1
|
|
56
|
+
self.do(CROLLBACK)
|
|
57
|
+
end
|
|
58
|
+
@transaction_depth -= 1
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def transaction
|
|
62
|
+
raise InterfaceError, "Database connection was already closed!" if @handle.nil?
|
|
63
|
+
raise InterfaceError, "No block given" unless block_given?
|
|
64
|
+
begin_transaction
|
|
65
|
+
begin
|
|
66
|
+
yield self
|
|
67
|
+
commit_transaction
|
|
68
|
+
rescue Exception
|
|
69
|
+
rollback_transaction
|
|
70
|
+
raise
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
conn.status = :IDLE
|
|
75
|
+
conn.parent = self
|
|
76
|
+
conn.transaction_depth = 0
|
|
77
|
+
conn
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def initialize(vendor=nil, host='localhost', dbName=nil, userName=nil, password=nil, poolSize=5, monitorInterval=300, &block)
|
|
81
|
+
if vendor.is_a?(Fixnum)
|
|
82
|
+
poolSize=vendor
|
|
83
|
+
monitorInterval = host if host.is_a?(Fixnum)
|
|
84
|
+
vendor = nil
|
|
85
|
+
host = nil
|
|
86
|
+
end
|
|
87
|
+
@classMutex = Mutex.new
|
|
88
|
+
@connectionFreed = ConditionVariable.new
|
|
89
|
+
@instance = nil
|
|
90
|
+
@mungeBlock = block ? block : Proc.new {|dbh| dbh}
|
|
91
|
+
|
|
92
|
+
raise ReInitException if @instance
|
|
93
|
+
|
|
94
|
+
@classMutex.synchronize {
|
|
95
|
+
@vendor = vendor
|
|
96
|
+
@host = host
|
|
97
|
+
@dbName = dbName
|
|
98
|
+
@userName = userName
|
|
99
|
+
@password = password
|
|
100
|
+
@poolSize = poolSize
|
|
101
|
+
@monitorInterval = monitorInterval
|
|
102
|
+
@pool = []
|
|
103
|
+
0.upto(@poolSize-1) do |i|
|
|
104
|
+
conn = @pool[i] = connect
|
|
105
|
+
make_singleton(conn)
|
|
106
|
+
end
|
|
107
|
+
@monitorThread = Thread.new do
|
|
108
|
+
while(true)
|
|
109
|
+
sleep(monitorInterval)
|
|
110
|
+
@classMutex.synchronize {
|
|
111
|
+
@pool.each_index do |idx|
|
|
112
|
+
conn = @pool[idx]
|
|
113
|
+
begin
|
|
114
|
+
ping = conn.respond_to?(:ping) ? conn.ping : true
|
|
115
|
+
unless ping
|
|
116
|
+
conn.disconnect
|
|
117
|
+
@pool[idx] = make_singleton(connect)
|
|
118
|
+
end
|
|
119
|
+
rescue Exception
|
|
120
|
+
@pool[idx] = make_singleton(connect)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
}
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
@instance = self
|
|
127
|
+
}
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def connect
|
|
132
|
+
dbh = nil
|
|
133
|
+
if @vendor
|
|
134
|
+
if @host.to_s != ''
|
|
135
|
+
if @userName.to_s != ''
|
|
136
|
+
dbh = DBI.connect("DBI:#{@vendor}:#{@dbName}:#{@host}", @userName, @password)
|
|
137
|
+
else
|
|
138
|
+
dbh = DBI.connect("DBI:#{@vendor}:#{@dbName}:#{@host}")
|
|
139
|
+
end
|
|
140
|
+
else
|
|
141
|
+
if @userName.to_s != ''
|
|
142
|
+
dbh = DBI.connect("DBI:#{@vendor}:#{@dbName}",@userName,@password)
|
|
143
|
+
else
|
|
144
|
+
dbh = DBI.connect("DBI:#{@vendor}:#{@dbName}")
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
@mungeBlock.call(dbh)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def instance?
|
|
152
|
+
return @instance ? true : false
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def finish
|
|
156
|
+
@classMutex.synchronize {
|
|
157
|
+
@monitorThread.stop
|
|
158
|
+
@pool.each do |conn|
|
|
159
|
+
conn.disconnect
|
|
160
|
+
end
|
|
161
|
+
}
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
#Get the next idle connection. If there is no idle connection, will block
|
|
166
|
+
#until there is one.
|
|
167
|
+
#Optionally accepts a block. If a block is given, will execute the block
|
|
168
|
+
#and free up the connection afterwards.
|
|
169
|
+
|
|
170
|
+
def getConnection
|
|
171
|
+
idleConn = nil #predeclare
|
|
172
|
+
# Continuation use here might be sexier, but...why do it?
|
|
173
|
+
@classMutex.synchronize {
|
|
174
|
+
# callcc do |cont|
|
|
175
|
+
# idleConn = @pool.find do |conn|
|
|
176
|
+
# conn.status == :IDLE
|
|
177
|
+
# end
|
|
178
|
+
# if not idleConn
|
|
179
|
+
# @connectionFreed.wait(@classMutex)
|
|
180
|
+
# cont.call
|
|
181
|
+
# end
|
|
182
|
+
# end
|
|
183
|
+
loop do
|
|
184
|
+
idleConn = @pool.find {|c| c.status == :IDLE}
|
|
185
|
+
if not idleConn
|
|
186
|
+
@connectionFreed.wait(@classMutex)
|
|
187
|
+
redo
|
|
188
|
+
end
|
|
189
|
+
break
|
|
190
|
+
end
|
|
191
|
+
idleConn.status = :BUSY
|
|
192
|
+
}
|
|
193
|
+
if block_given?
|
|
194
|
+
begin
|
|
195
|
+
yield idleConn
|
|
196
|
+
ensure
|
|
197
|
+
idleConn.freeConnection
|
|
198
|
+
end
|
|
199
|
+
else
|
|
200
|
+
return idleConn
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def freeConnection(usedConn)
|
|
206
|
+
conn = nil
|
|
207
|
+
@classMutex.synchronize {
|
|
208
|
+
conn = @pool.find do |conn|
|
|
209
|
+
conn == usedConn
|
|
210
|
+
end
|
|
211
|
+
}
|
|
212
|
+
if conn
|
|
213
|
+
conn.status = :IDLE
|
|
214
|
+
@connectionFreed.signal
|
|
215
|
+
else
|
|
216
|
+
raise MissingConnectionException
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
conn.status
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Iowa
|
|
2
|
+
class DetachedComponent < Iowa::Component
|
|
3
|
+
def self.template
|
|
4
|
+
@mtemplate
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.template=(args)
|
|
8
|
+
if args.is_a?(Array)
|
|
9
|
+
template_data = args[0]
|
|
10
|
+
binding_data = args[1]
|
|
11
|
+
else
|
|
12
|
+
template_data = args
|
|
13
|
+
binding_data = Iowa::C_empty
|
|
14
|
+
end
|
|
15
|
+
@mtemplate = Iowa::TemplateParser.new(template_data,Iowa::BindingsParser.new(binding_data,self.class).bindings,self).root
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Iowa
|
|
2
|
+
class Dispatcher
|
|
3
|
+
|
|
4
|
+
class CantHandleRequest < Exception; end
|
|
5
|
+
|
|
6
|
+
def initialize(*args)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Returns true if the dispatcher is willing to handle this request.
|
|
10
|
+
|
|
11
|
+
def handleRequest?(path)
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Dispatches the request.
|
|
16
|
+
|
|
17
|
+
def dispatch(session,context,dispatch_destination = nil)
|
|
18
|
+
if handleRequest?(context.request.uri)
|
|
19
|
+
dispatch_destination = Iowa::DispatchDestination.new(CMain) unless context.requestID || dispatch_destination
|
|
20
|
+
else
|
|
21
|
+
raise CantHandleRequest, "This dispatcher doesn't know how to handle the request for #{context.request.uri}."
|
|
22
|
+
end
|
|
23
|
+
session.handleRequest(context,dispatch_destination)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
require 'iowa/ImageSize'
|
|
2
|
+
require 'iowa/Webcache'
|
|
3
|
+
|
|
4
|
+
# Notes on tags and tag logic:
|
|
5
|
+
# Currently all "builtin" tags are defined in two files, DynamicElements.rb
|
|
6
|
+
# and Form.rb. This should be broken up and restructured. Tags, or at least
|
|
7
|
+
# familes of tags (i.e. all input type tags are a family) should each be
|
|
8
|
+
# be defined in a separate file, and there should be some sort of "include path"
|
|
9
|
+
# for finding tags. This makes it easy to add new tags without editing any
|
|
10
|
+
# core files.
|
|
11
|
+
|
|
12
|
+
module Iowa
|
|
13
|
+
|
|
14
|
+
class P < Tag
|
|
15
|
+
def defaultBindings
|
|
16
|
+
@bindings[Cvalue] = PathAssociation.new(@name)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def handleRequest(context)
|
|
20
|
+
handleChildren(:handleRequest, context)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def handleResponse(context)
|
|
24
|
+
value = context.getBinding(@bindings[Cvalue]) if context.testBinding(@bindings[Cvalue])
|
|
25
|
+
context.response << openTag(context)
|
|
26
|
+
context.response << value if value
|
|
27
|
+
handleChildren(:handleResponse, context)
|
|
28
|
+
context.response << closeTag
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# There is a pile of HTML tag types which are essentially just containers,
|
|
33
|
+
# like a <p>. In the context of a browser, they each have different meanings,
|
|
34
|
+
# but in IOWA, they are all just containers.
|
|
35
|
+
|
|
36
|
+
class Abbr < P; end
|
|
37
|
+
class Acronym < P; end
|
|
38
|
+
class Address < P; end
|
|
39
|
+
class B < P; end
|
|
40
|
+
class Bdo < P; end
|
|
41
|
+
class Big < P; end
|
|
42
|
+
class Blockquote < P; end
|
|
43
|
+
class Body < P; end
|
|
44
|
+
class Button < P; end
|
|
45
|
+
class Caption < P; end
|
|
46
|
+
class Cite < P; end
|
|
47
|
+
class Code < P; end
|
|
48
|
+
class Colgroup < P; end
|
|
49
|
+
class Dd < P; end
|
|
50
|
+
class Del < P; end
|
|
51
|
+
class Div < P; end
|
|
52
|
+
class Dfn < P; end
|
|
53
|
+
class Dt < P; end
|
|
54
|
+
class Em < P; end
|
|
55
|
+
class Fieldset < P; end
|
|
56
|
+
class Frameset < P; end
|
|
57
|
+
class H1 < P; end
|
|
58
|
+
class H2 < P; end
|
|
59
|
+
class H3 < P; end
|
|
60
|
+
class H4 < P; end
|
|
61
|
+
class H5 < P; end
|
|
62
|
+
class H6 < P; end
|
|
63
|
+
class Head < P; end
|
|
64
|
+
class Html < P; end
|
|
65
|
+
class I < P; end
|
|
66
|
+
class Iframe < P; end
|
|
67
|
+
class Ins < P; end
|
|
68
|
+
class Kbd < P; end
|
|
69
|
+
class Label < P; end
|
|
70
|
+
class Legend < P; end
|
|
71
|
+
class Li < P; end
|
|
72
|
+
class Map < P; end
|
|
73
|
+
class Noframes < P; end
|
|
74
|
+
class Noscript < P; end
|
|
75
|
+
class Object < P; end
|
|
76
|
+
class Optiongroup < P; end
|
|
77
|
+
class Pre < P; end
|
|
78
|
+
class Q < P; end
|
|
79
|
+
class Samp < P; end
|
|
80
|
+
class Script < P; end
|
|
81
|
+
class Small < P; end
|
|
82
|
+
class Span < P; end
|
|
83
|
+
class Strong < P; end
|
|
84
|
+
class Style < P; end
|
|
85
|
+
class Sub < P; end
|
|
86
|
+
class Sup < P; end
|
|
87
|
+
class TBody < P; end
|
|
88
|
+
class TFoot < P; end
|
|
89
|
+
class THead < P; end
|
|
90
|
+
class Title < P; end
|
|
91
|
+
class TT < P; end
|
|
92
|
+
class Var < P; end
|
|
93
|
+
|
|
94
|
+
class LonelyTag < Tag
|
|
95
|
+
def handleResponse(context)
|
|
96
|
+
context.response << lonelyTag(context)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
class Area < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
101
|
+
class Base < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
102
|
+
class Col < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
103
|
+
class Frame < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
104
|
+
class Link < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
105
|
+
class Meta < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
106
|
+
class Param < LonelyTag; Iowa::TemplateParser.register_tag(self,:bodyless); end
|
|
107
|
+
|
|
108
|
+
# Subclass of Tag that defines an Iowa anchor element.
|
|
109
|
+
|
|
110
|
+
class A < Tag
|
|
111
|
+
|
|
112
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
113
|
+
|
|
114
|
+
# The default binding for an anchor is to establish an action
|
|
115
|
+
# with a literal association. i.e. oid="frumption" binds a
|
|
116
|
+
# call to "frumption" as the action for the element.
|
|
117
|
+
|
|
118
|
+
def defaultBindings
|
|
119
|
+
@bindings[Caction] = LiteralAssociation.new(@name)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def handleRequest(context)
|
|
123
|
+
if(context.actionID == context.elementID)
|
|
124
|
+
context.setAction(@bindings[Caction])
|
|
125
|
+
context.element_attributes = @attributes.dup
|
|
126
|
+
rc = Iowa.response_cacheable_from_attributes?(@attributes)
|
|
127
|
+
context[:request_cacheable] = rc if !rc.nil?
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
handleChildren(:handleRequest, context)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def handleResponse(context)
|
|
134
|
+
actionURL = context.actionURL
|
|
135
|
+
if @bindings.has_key?(Cid)
|
|
136
|
+
context.url_for_id[context.getBinding(@bindings[Cid])] = actionURL
|
|
137
|
+
end
|
|
138
|
+
context.response << openTag(Chref, actionURL, context)
|
|
139
|
+
handleChildren(:handleResponse, context)
|
|
140
|
+
context.response << closeTag
|
|
141
|
+
context[:skip_pagecache] = false
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
class Url < A
|
|
146
|
+
|
|
147
|
+
Iowa::TemplateParser.register_tag(self,:bodyless)
|
|
148
|
+
|
|
149
|
+
def handleResponse(context)
|
|
150
|
+
actionURL = context.actionURL
|
|
151
|
+
if @bindings.has_key?(Cid)
|
|
152
|
+
context.url_for_id[context.getBinding(@bindings[Cid])] = actionURL
|
|
153
|
+
end
|
|
154
|
+
context.response << actionURL
|
|
155
|
+
context[:skip_pagecache] = false
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
class Img < Tag
|
|
160
|
+
|
|
161
|
+
Iowa::TemplateParser.register_tag(self,:bodyless)
|
|
162
|
+
|
|
163
|
+
def webcache_size; 100; end
|
|
164
|
+
|
|
165
|
+
def initialize(*args)
|
|
166
|
+
@@image_size_cache ||= {}
|
|
167
|
+
@@webcache = Iowa::Webcache.new(webcache_size)
|
|
168
|
+
super(*args)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def defaultBindings
|
|
172
|
+
@bindings[Caction] = LiteralAssociation.new(@name)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def get_image_size_by_path(path)
|
|
176
|
+
File.open(path) {|fh| Iowa::ImageSize.new(fh)}
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def get_image_size_by_data(data)
|
|
180
|
+
Iowa::ImageSize.new(data.to_s)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Change this so it can take a local path OR a URL.
|
|
184
|
+
def handleResponse(context)
|
|
185
|
+
image_url,image_path = context.getBinding(@bindings[Caction])
|
|
186
|
+
img = nil
|
|
187
|
+
if image_path.to_s != '' && FileTest.exists?(image_path)
|
|
188
|
+
img = nil
|
|
189
|
+
unless @@image_size_cache.has_key?(Cimage_path)
|
|
190
|
+
img = get_image_size_by_path(image_path)
|
|
191
|
+
@@image_size_cache[image_path] = [img,File.stat(image_path)]
|
|
192
|
+
else
|
|
193
|
+
img,st = @@image_size_cache[image_path]
|
|
194
|
+
if File.stat(image_path).mtime != st.mtime
|
|
195
|
+
img = get_image_size_by_path(image_path)
|
|
196
|
+
@@image_size_cache[image_path] = [img.File.stat(image_path)]
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
elsif image_url.to_s != ''
|
|
200
|
+
if data = @@webcache[image_url]
|
|
201
|
+
@@image_size_cache[image_url] = get_image_size_by_data(data)
|
|
202
|
+
end
|
|
203
|
+
img = @@image_size_cache[image_url]
|
|
204
|
+
end
|
|
205
|
+
if img
|
|
206
|
+
if (img.height) and (img.width)
|
|
207
|
+
context.response << openTag(Csrc,image_url,Cheight,img.height,Cwidth,img.width,context)
|
|
208
|
+
else
|
|
209
|
+
context.response << openTag(Csrc,image_url,context)
|
|
210
|
+
end
|
|
211
|
+
handleChildren(:handleResponse, context)
|
|
212
|
+
context.response << closeTag
|
|
213
|
+
else
|
|
214
|
+
context.response << openTag(Csrc,image_url,context)
|
|
215
|
+
handleChildren(:handleResponse, context)
|
|
216
|
+
context.response << closeTag
|
|
217
|
+
end
|
|
218
|
+
context[:skip_pagecache] = false
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# Subclass of Tag that defines an Iowa string element.
|
|
224
|
+
# Note that Strings are usually referred to in a template
|
|
225
|
+
# via the shortcut syntax of '@foo'.
|
|
226
|
+
|
|
227
|
+
class DynamicString < Tag
|
|
228
|
+
def defaultBindings
|
|
229
|
+
@bindings[Cvalue] = PathAssociation.new(@name)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Short circuits calls back to Element#handleRequest and thus
|
|
233
|
+
# Element#handleChildren since a DynamicString will never have children.
|
|
234
|
+
|
|
235
|
+
def handleRequest(context)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def handleResponse(context)
|
|
239
|
+
val = context.getBinding(@bindings[Cvalue])
|
|
240
|
+
if(val)
|
|
241
|
+
context.response << "#{val}"
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# This tag provides a static, mulilingual string capability.
|
|
247
|
+
# This can be shortcut in a template using ^foo.
|
|
248
|
+
|
|
249
|
+
class MLString < Tag
|
|
250
|
+
def defaultBindings
|
|
251
|
+
@bindings[Cvalue] = LiteralAssociation.new(@name)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def handleRequest(context); end
|
|
255
|
+
|
|
256
|
+
def handleResponse(context)
|
|
257
|
+
# Need to implement finding the desired string.
|
|
258
|
+
val = context.getBinding(@bindings[Cvalue])
|
|
259
|
+
if (val)
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class RepeatReadOnly < Tag
|
|
266
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
267
|
+
|
|
268
|
+
def defaultBindings
|
|
269
|
+
@bindings[Clist] = nil
|
|
270
|
+
@bindings[Citem] = nil
|
|
271
|
+
@bindings[Ckey] = nil
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def commit_callback_setup(list,ras,context); end
|
|
275
|
+
def commit_callback_association(ras,item_idx,context); end
|
|
276
|
+
|
|
277
|
+
def setupBindings(context)
|
|
278
|
+
if @bindings[Clist].nil? and @bindings[Citem]
|
|
279
|
+
if @name[0] == 123
|
|
280
|
+
@bindings[Clist] = LiteralAssociation.new(Proc.new {eval(@name[1..-2])})
|
|
281
|
+
else
|
|
282
|
+
@bindings[Clist] = PathAssociation.new(@name)
|
|
283
|
+
end
|
|
284
|
+
elsif @bindings[Citem].nil? and @bindings[Clist]
|
|
285
|
+
@bindings[Citem] = PathAssociation.new(@name)
|
|
286
|
+
elsif @bindings[Clist].nil? and @bindings[Citem].nil?
|
|
287
|
+
if @name[0] == 123
|
|
288
|
+
@bindings[Clist] = LiteralAssociation.new(Proc.new {eval(@name[1..-2])})
|
|
289
|
+
@bindings[Citem] = PathAssociation.new(C_item)
|
|
290
|
+
elsif context.testBinding(PathAssociation.new(@name + C_list))
|
|
291
|
+
@bindings[Clist] = b
|
|
292
|
+
@bindings[Citem] = PathAssociation.new(@name)
|
|
293
|
+
else
|
|
294
|
+
@bindings[Clist] = PathAssociation.new(@name)
|
|
295
|
+
@bindings[Citem] = PathAssociation.new(C_item)
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Now, check to see if the binding for item responds. If it does not,
|
|
300
|
+
# create it.
|
|
301
|
+
|
|
302
|
+
context.createAccessor(@bindings[Citem]) unless context.testBinding(@bindings[Citem])
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def handleRequestOrResponse(method, context)
|
|
306
|
+
setupBindings(context)
|
|
307
|
+
keystack = context.session[C__keystack]
|
|
308
|
+
|
|
309
|
+
list = context.getBinding(@bindings[Clist],nil,keystack.join(C_slash))
|
|
310
|
+
key = @bindings[Ckey]
|
|
311
|
+
ras = context.root
|
|
312
|
+
if list
|
|
313
|
+
context.pushElement
|
|
314
|
+
|
|
315
|
+
# This lets changes in the iterator get applied back to the list directly.
|
|
316
|
+
# In this read only class, these are noops, but in the subclass, these
|
|
317
|
+
# can be defined.
|
|
318
|
+
commit_callback_setup(list,ras,context)
|
|
319
|
+
|
|
320
|
+
list.each_index do |item_idx|
|
|
321
|
+
item = list[item_idx]
|
|
322
|
+
keystack.push(item.hash)
|
|
323
|
+
context.setBindingNow(@bindings[Citem], item)
|
|
324
|
+
if(key)
|
|
325
|
+
context.elementID = context.getBinding(key,nil,keystack.join(C_slash))
|
|
326
|
+
else
|
|
327
|
+
context.nextElement!
|
|
328
|
+
end
|
|
329
|
+
commit_callback_association(ras,item_idx,context)
|
|
330
|
+
handleChildren(method, context)
|
|
331
|
+
keystack.pop
|
|
332
|
+
end
|
|
333
|
+
context.popElement
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
class RepeatRO < RepeatReadOnly
|
|
339
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Subclass of Tag that implements an Iowa element for repeating
|
|
343
|
+
# portions of a template.
|
|
344
|
+
|
|
345
|
+
class Repeat < RepeatReadOnly
|
|
346
|
+
|
|
347
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
348
|
+
|
|
349
|
+
def commit_callback_setup(list,ras,context)
|
|
350
|
+
context.commit_callbacks[@bindings[Citem].association] ||= {}
|
|
351
|
+
blk = Proc.new {|val,idx| list[idx] = val}
|
|
352
|
+
context.commit_callbacks[@bindings[Citem].association][ras] = [blk,nil]
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
def commit_callback_association(ras,item_idx,context)
|
|
356
|
+
context.commit_callbacks[@bindings[Citem].association][ras][1] = item_idx
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Subclass of Repeat. Syntactic sugar.
|
|
362
|
+
|
|
363
|
+
class Table < Repeat
|
|
364
|
+
|
|
365
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
366
|
+
|
|
367
|
+
def handleResponse(context)
|
|
368
|
+
context.response << openTag(context)
|
|
369
|
+
super(context)
|
|
370
|
+
context.response << closeTag
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
class TR < Table; Iowa::TemplateParser.register_tag(self,:mandatory_body); end
|
|
375
|
+
class UL < Table; Iowa::TemplateParser.register_tag(self,:mandatory_body); end
|
|
376
|
+
class OL < Table; Iowa::TemplateParser.register_tag(self,:mandatory_body); end
|
|
377
|
+
class DL < Table; Iowa::TemplateParser.register_tag(self,:mandatory_body); end
|
|
378
|
+
|
|
379
|
+
class SideEffect < Tag
|
|
380
|
+
|
|
381
|
+
def handleResponse(context)
|
|
382
|
+
context.response << openTag(context)
|
|
383
|
+
super(context)
|
|
384
|
+
context.response << closeTag
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def handleRequest(context)
|
|
388
|
+
handleChildren(:handleRequest, context)
|
|
389
|
+
end
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
# Subclass of Tag that allows for optional sections within a template.
|
|
394
|
+
# Evaluation is simple. If the condition (the item referenced by the
|
|
395
|
+
# oid attribute in the tag) evaulates to true (Ruby's notion of true)
|
|
396
|
+
# then the body of the <IF> tag will be displayed. Otherwise it will
|
|
397
|
+
# not be displayed.
|
|
398
|
+
|
|
399
|
+
class If < Tag
|
|
400
|
+
|
|
401
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def defaultBindings
|
|
405
|
+
@bindings[Ccondition] = PathAssociation.new(@name)
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
def testCondition(condition)
|
|
409
|
+
condition
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
def handleRequestOrResponse(method, context)
|
|
413
|
+
condition = context.getBinding(@bindings[Ccondition])
|
|
414
|
+
context.element_attributes = @attributes
|
|
415
|
+
if testCondition(condition)
|
|
416
|
+
handleChildren(method, context)
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
# Subclass of If that implements inverse functionality. If the
|
|
422
|
+
# condition evaluates to false, then the body of the <UNLESS> tag
|
|
423
|
+
# will be displayed.
|
|
424
|
+
|
|
425
|
+
class Unless < If
|
|
426
|
+
|
|
427
|
+
Iowa::TemplateParser.register_tag(self,:mandatory_body)
|
|
428
|
+
|
|
429
|
+
def testCondition(condition)
|
|
430
|
+
!condition
|
|
431
|
+
end
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
#Deprecated; will be removed.
|
|
435
|
+
# Can we have an Else, too?
|
|
436
|
+
|
|
437
|
+
class IfCondition < If
|
|
438
|
+
def handleResponse(context)
|
|
439
|
+
context.response << openTag(context)
|
|
440
|
+
super(context)
|
|
441
|
+
context.response << closeTag
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
class TextElement < String
|
|
446
|
+
def handleRequest(context); end
|
|
447
|
+
def handleResponse(context); context.response << self; end
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
class BodyContent < Element
|
|
451
|
+
|
|
452
|
+
def handleRequestOrResponse(method, context)
|
|
453
|
+
root = context.popRoot
|
|
454
|
+
root.handleChildren(method, context)
|
|
455
|
+
context.pushRoot root
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
def Iowa.response_cacheable_from_attributes?(attr)
|
|
460
|
+
if attr.has_key?(Ccacheable) and rc = attr[Ccacheable].downcase
|
|
461
|
+
if rc == C0 or rc == Cfalse
|
|
462
|
+
false
|
|
463
|
+
elsif rc == C1 or rc == Ctrue
|
|
464
|
+
true
|
|
465
|
+
end
|
|
466
|
+
else
|
|
467
|
+
nil
|
|
468
|
+
end
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
end
|