├── .gitignore ├── .hgignore ├── .hgtags ├── Emakefile ├── INSTALL ├── LICENSE ├── README.markdown ├── bin ├── add.erl ├── compile.erl ├── e_component.erl ├── e_component_uploader.erl ├── generate.erl ├── otp.erl ├── prepare.erl ├── start.erl ├── tarball.erl └── test.erl ├── doc ├── DOC └── NEXT_RELEASE └── lib ├── eptic-1.4.1 ├── Emakefile ├── README ├── doc │ └── overview.edoc ├── ebin │ └── eptic.app ├── include │ ├── e_annotation.hrl │ ├── e_db_couchdb.hrl │ ├── e_mod_ewgi.hrl │ ├── eptic.hrl │ └── s_vfs.hrl ├── priv │ ├── errors.conf │ ├── ewgi_inets.conf │ ├── ewgi_inets_https.conf │ ├── inets.conf │ ├── inets_https.conf │ ├── mime.types │ └── yaws.conf ├── src │ ├── e_annotation.erl │ ├── e_cache.erl │ ├── e_cache_disk.erl │ ├── e_cache_ets.erl │ ├── e_cluster.erl │ ├── e_component.erl │ ├── e_conf.erl │ ├── e_db.erl │ ├── e_db_couchdb.erl │ ├── e_db_mnesia.erl │ ├── e_dict.erl │ ├── e_dispatcher.erl │ ├── e_error.erl │ ├── e_file.erl │ ├── e_hook.erl │ ├── e_json.erl │ ├── e_lang.erl │ ├── e_logger.erl │ ├── e_logger_viewer.erl │ ├── e_mod_ewgi.erl │ ├── e_mod_gen.erl │ ├── e_mod_inets.erl │ ├── e_mod_yaws.erl │ ├── e_multipart_common.erl │ ├── e_multipart_inets.erl │ ├── e_multipart_yaws.erl │ ├── e_session.erl │ ├── e_start.erl │ ├── e_user_annotation.erl │ ├── e_validator.erl │ └── eptic.erl ├── test │ └── e_dict_test.erl └── tests │ ├── Emakefile │ └── cache_performance_test.erl ├── eptic_fe-1.0 ├── doc │ └── overview.edoc ├── ebin │ └── eptic_fe.app ├── priv │ ├── inets.conf │ ├── inets_https.conf │ ├── mime.types │ └── yaws.conf └── src │ ├── e_fe_cache.erl │ ├── e_fe_cluster.erl │ ├── e_fe_gc.erl │ ├── e_fe_mod_gen.erl │ ├── e_fe_mod_inets.erl │ ├── e_fe_mod_yaws.erl │ ├── e_fe_proxy.erl │ └── eptic_fe.erl ├── erlydtl-0.5.3 ├── Emakefile ├── Makefile ├── README ├── ebin │ └── erlydtl.app ├── examples │ └── docroot │ │ ├── autoescape │ │ ├── base │ │ ├── comment │ │ ├── custom_call │ │ ├── custom_tag │ │ ├── custom_tag_error │ │ ├── cycle │ │ ├── extends │ │ ├── extends_path │ │ ├── extends_path2 │ │ ├── filters │ │ ├── for │ │ ├── for_list │ │ ├── for_list_preset │ │ ├── for_preset │ │ ├── for_records │ │ ├── for_records_preset │ │ ├── for_tuple │ │ ├── if │ │ ├── if_preset │ │ ├── ifequal │ │ ├── ifequal_preset │ │ ├── ifnotequal │ │ ├── ifnotequal_preset │ │ ├── include │ │ ├── include.html │ │ ├── include_path │ │ ├── include_template │ │ ├── now │ │ ├── path1 │ │ ├── base1 │ │ ├── base2 │ │ ├── include1 │ │ └── template1 │ │ ├── path2 │ │ ├── base2 │ │ └── template2 │ │ ├── var │ │ ├── var_error │ │ └── var_preset ├── priv │ └── custom_tags │ │ └── flashvideo └── src │ ├── erlydtl │ ├── erlydtl.app │ ├── erlydtl.erl │ ├── erlydtl_compiler.erl │ ├── erlydtl_dateformat.erl │ ├── erlydtl_deps.erl │ ├── erlydtl_filters.erl │ ├── erlydtl_parser.erl │ ├── erlydtl_parser.yrl │ ├── erlydtl_runtime.erl │ └── erlydtl_scanner.erl │ └── tests │ ├── erlydtl_dateformat_tests.erl │ ├── erlydtl_example_variable_storage.erl │ ├── erlydtl_functional_tests.erl │ └── erlydtl_unittests.erl ├── ewgi-0.2 ├── AUTHORS ├── Emakefile ├── LICENSE ├── Makefile ├── README.rst ├── _build.cfg ├── doc │ └── SPEC.rst ├── ebin │ └── ewgi.app ├── include │ ├── ewgi.hrl │ └── yaws_api.hrl └── src │ ├── ewgi.app │ ├── ewgi_api.erl │ ├── ewgi_application.erl │ ├── ewgi_inets.erl │ ├── ewgi_mochiweb.erl │ ├── ewgi_test.erl │ └── ewgi_yaws.erl ├── ewts-1.0 ├── Emakefile ├── doc │ └── overview.edoc ├── ebin │ └── ewts.app ├── include │ └── request.hrl └── src │ ├── e_mod_ewts.erl │ ├── ewts.erl │ ├── ewts_app.erl │ ├── ewts_client.erl │ ├── ewts_dbg.erl │ └── ewts_sup.erl ├── wpart-1.4.1 ├── doc │ └── overview.edoc ├── ebin │ └── wpart.app ├── src │ ├── Emakefile │ ├── erlydtl_expander.erl │ ├── utf8.erl │ ├── utf8_api.erl │ ├── validate_tool.erl │ ├── wpart.erl │ ├── wpart_app.erl │ ├── wpart_cache.erl │ ├── wpart_db.erl │ ├── wpart_gen.erl │ ├── wpart_master.erl │ ├── wpart_time_str.erl │ ├── wpart_utils.erl │ ├── wpart_valid.erl │ ├── wpart_xs.erl │ ├── wpartlib.erl │ ├── wtpl.erl │ └── wtype.erl └── tests │ └── Emakefile ├── wparts-1.4.1 ├── doc │ └── overview.edoc ├── ebin │ └── wparts.app ├── priv │ ├── autocomplete.css │ ├── basic_types.conf │ ├── html │ │ ├── atom.tpl │ │ ├── autocomplete.tpl │ │ ├── bool.tpl │ │ ├── collection_element.tpl │ │ ├── csv.tpl │ │ ├── date.tpl │ │ ├── datetime.tpl │ │ ├── derived.tpl │ │ ├── div_form.tpl │ │ ├── div_item.tpl │ │ ├── enum.tpl │ │ ├── float.tpl │ │ ├── form.tpl │ │ ├── input_id.tpl │ │ ├── integer.tpl │ │ ├── list_form.tpl │ │ ├── list_item.tpl │ │ ├── multiselect.tpl │ │ ├── option.tpl │ │ ├── paragraph_form.tpl │ │ ├── paragraph_item.tpl │ │ ├── password.tpl │ │ ├── select.tpl │ │ ├── span.tpl │ │ ├── string.tpl │ │ ├── table_form.tpl │ │ ├── table_item.tpl │ │ ├── text.tpl │ │ ├── time.tpl │ │ ├── upload.tpl │ │ └── upload_edit.tpl │ ├── indicator.gif │ ├── jquery.autocomplete.js │ └── jquery.js ├── src │ ├── wpart_atom.erl │ ├── wpart_autocomplete.erl │ ├── wpart_bool.erl │ ├── wpart_choose.erl │ ├── wpart_collection.erl │ ├── wpart_comment.erl │ ├── wpart_csv.erl │ ├── wpart_date.erl │ ├── wpart_datetime.erl │ ├── wpart_derived.erl │ ├── wpart_enum.erl │ ├── wpart_float.erl │ ├── wpart_form.erl │ ├── wpart_include.erl │ ├── wpart_input.erl │ ├── wpart_integer.erl │ ├── wpart_lang.erl │ ├── wpart_list.erl │ ├── wpart_lookup.erl │ ├── wpart_lookup_unbreak.erl │ ├── wpart_multilist.erl │ ├── wpart_multiselect.erl │ ├── wpart_paginate.erl │ ├── wpart_password.erl │ ├── wpart_string.erl │ ├── wpart_text.erl │ ├── wpart_time.erl │ ├── wpart_upload.erl │ ├── wtype_atom.erl │ ├── wtype_autocomplete.erl │ ├── wtype_bool.erl │ ├── wtype_collection.erl │ ├── wtype_csv.erl │ ├── wtype_date.erl │ ├── wtype_datetime.erl │ ├── wtype_enum.erl │ ├── wtype_float.erl │ ├── wtype_html.erl │ ├── wtype_integer.erl │ ├── wtype_multilist.erl │ ├── wtype_multiselect.erl │ ├── wtype_password.erl │ ├── wtype_string.erl │ ├── wtype_term.erl │ ├── wtype_text.erl │ ├── wtype_time.erl │ └── wtype_upload.erl └── tests │ ├── Emakefile │ ├── datetime_format_tests.erl │ └── run_all.sh └── yaws-1.85 ├── LICENSE ├── ebin ├── .empty ├── authmod_gssapi.beam ├── haxe.beam ├── json.beam ├── jsonrpc.beam ├── mime_type_c.beam ├── mime_types.beam ├── yaws.app ├── yaws.beam ├── yaws_api.beam ├── yaws_app.beam ├── yaws_appmod_cgi.beam ├── yaws_appmod_fcgi.beam ├── yaws_cgi.beam ├── yaws_compile.beam ├── yaws_config.beam ├── yaws_ctl.beam ├── yaws_dav.beam ├── yaws_debug.beam ├── yaws_generated.beam ├── yaws_html.beam ├── yaws_jsonrpc.beam ├── yaws_log.beam ├── yaws_log_file_h.beam ├── yaws_ls.beam ├── yaws_multipart.beam ├── yaws_outmod.beam ├── yaws_pam.beam ├── yaws_revproxy.beam ├── yaws_rpc.beam ├── yaws_rss.beam ├── yaws_sendfile.beam ├── yaws_sendfile_compat.beam ├── yaws_server.beam ├── yaws_session_server.beam ├── yaws_soap_lib.beam ├── yaws_soap_srv.beam ├── yaws_stats.beam ├── yaws_sup.beam ├── yaws_sup_restarts.beam ├── yaws_ticker.beam ├── yaws_xmlrpc.beam └── yaws_zlib.beam ├── include ├── erlsom.hrl ├── soap.hrl ├── yaws.hrl ├── yaws_api.hrl └── yaws_dav.hrl └── priv ├── envelope.xsd ├── lib ├── setuid_drv.so └── yaws_sendfile_drv.so ├── soap.xsd └── wsdl.xsd /.gitignore: -------------------------------------------------------------------------------- 1 | *beam 2 | *~ 3 | *annotations.hrl 4 | *.hg* 5 | *.svn* 6 | -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | *beam 3 | *~ 4 | *annotations.hrl 5 | *.git* 6 | *.svn* 7 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | d93c728f66523b2eb7b58299130d26d7698caea3 1.3rc1 2 | f9787411670df615ca8df2e215a6154a59c7331d 1.3 3 | de04dc1e7d2198917d7be1c6ca3b0281cc30f4f2 1.4rc1 4 | 95e4b04f954bac4bc994f5a4874b03f339a3a543 1.4 5 | 95e4b04f954bac4bc994f5a4874b03f339a3a543 1.4 6 | 0000000000000000000000000000000000000000 1.4 7 | 0000000000000000000000000000000000000000 1.4 8 | 386467b5af7d9d7acc54ec7222a68d5d8b3db893 1.4 9 | -------------------------------------------------------------------------------- /Emakefile: -------------------------------------------------------------------------------- 1 | {'lib/eptic-1.4.1/src/*', [ 2 | {outdir, "lib/eptic-1.4.1/ebin"}, 3 | {i, "lib/eptic-1.4.1/include"}, 4 | {i, "lib/yaws-1.85/include"}, 5 | debug_info, 6 | strict_record_tests, 7 | netload]}. 8 | 9 | {'lib/eptic_fe-1.0/src/*', 10 | [{outdir, "lib/eptic_fe-1.0/ebin"}, 11 | {i, "lib/eptic-1.4.1/include"}, 12 | {i, "lib/eptic_fe-1.0/include"}, 13 | {i, "lib/yaws-1.85/include"}, 14 | debug_info, 15 | strict_record_tests, 16 | netload]}. 17 | 18 | {'lib/wpart-1.4.1/src/*',[ 19 | {outdir, "lib/wpart-1.4.1/ebin"}, 20 | {i, "lib/wpart-1.4.1/include"}, 21 | debug_info, 22 | strict_record_tests, 23 | netload]}. 24 | 25 | {'lib/wparts-1.4.1/src/*',[ 26 | {outdir, "lib/wparts-1.4.1/ebin"}, 27 | {i, "lib/wparts-1.4.1/include"}, 28 | debug_info, 29 | strict_record_tests, 30 | netload]}. 31 | 32 | {'lib/ewgi-0.2/src/*',[ 33 | {outdir, "lib/ewgi-0.2/ebin"}, 34 | {i, "lib/ewgi-0.2/include"}, 35 | debug_info, 36 | strict_record_tests, 37 | netload]}. 38 | 39 | {'lib/erlydtl-0.5.3/src/erlydtl/*',[ 40 | {outdir, "lib/erlydtl-0.5.3/ebin"}, 41 | {i, "lib/erlydtl-0.5.3/include"}, 42 | debug_info, 43 | strict_record_tests, 44 | netload]}. 45 | 46 | {'lib/ewts-1.0/src/*', [ 47 | {outdir, "lib/ewts-1.0/ebin"}, 48 | {i, "lib/ewts-1.0/include"}, 49 | debug_info, 50 | strict_record_tests, 51 | netload]}. 52 | 53 | {"lib/myapp-0.1/src/*", 54 | [{outdir,"lib/myapp-0.1/ebin"}, 55 | {i,"lib/myapp-0.1/include"}, 56 | debug_info,strict_record_tests,netload]}. 57 | 58 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | ErlangWeb 1.4.1 Installation Guide 2 | ================================== 3 | 4 | 1. Requirements 5 | -Erlang/OTP R12B-5 or later 6 | -Yaws 1.80 or later (included in the package) 7 | 8 | 2. Start 9 | To start working with Erlang Web you should compile the three main applications: 10 | eptic, wpart and wparts. It could be easily done by typing 11 | bin/compile.erl 12 | in the root directory of the framework. 13 | You will also need one of the supported HTTP servers. To make your life easier, 14 | Yaws server is included in version 1.80 together with pre-compiled beams. 15 | 16 | After that you can either use generic directory builder: 17 | bin/start.erl 18 | or create all the folders by your own. 19 | 20 | If you decided to use start.erl script, your server is ready to use and you can 21 | start it in an interactive mode: 22 | bin/start interactive 23 | and then try: 24 | http://localhost:8080/ 25 | 26 | 3. Details 27 | More details can be found on http://wiki.erlang-web.org/ 28 | 29 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | #Erlang Web 2 | 3 | Erlang Web is an open source framework for applications based on HTTP protocol. 4 | It can be used to build dynamic websites and web services. Erlang Web is a 5 | full-stack framework that provides programmers with all the functionality 6 | needed to do the job. It makes it easy to build scalable and fault-tolerant 7 | websites. Erlang Web takes some inspiration from other web frameworks 8 | for dynamic languages such as [Ruby on Rails](http://rubyonrails.org/) 9 | or [Django](http://www.djangoproject.com/). 10 | 11 | Some notable users of Erlang Web are: 12 | 13 | * Current version of [Erlang's official website](http://www.erlang.org) 14 | * [Erlang Factory website](http://www.erlang-factory.com/) 15 | * [*Erlang Programming* book's website](http://www.erlangprogramming.org/) 16 | * [Erlang Solutions website](http://www.erlang-solutions.com/) 17 | -------------------------------------------------------------------------------- /bin/e_component_uploader.erl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | 3 | main(Args) -> 4 | inets:start(), 5 | application:start(crypto), 6 | action(Args). 7 | 8 | action(["add", Path]) -> 9 | [AppName] = filelib:wildcard(Path ++ "/ebin/*.app"), 10 | {ok, [{application, Name0, Props}]} = file:consult(AppName), 11 | Md5Ctx = crypto:md5_init(), 12 | 13 | Name = atom_to_list(Name0), 14 | Content = read_package(create_package(Name, Path)), 15 | 16 | Username = string:strip(io:get_line("Username: "), both, 10), 17 | ContentCtx = crypto:md5_update(Md5Ctx, Content), 18 | PasswdCtx = crypto:md5_update(ContentCtx, string:strip(io:get_line("Password: "), both, 10)), 19 | FinalMd5 = hash(binary_to_list(crypto:md5_final(PasswdCtx))), 20 | 21 | Categories = string:strip(io:get_line("Enter the categories for the ecomponent (separated by \",\"): "), both, 10), 22 | Vsn = proplists:get_value(vsn, Props), 23 | Desc = proplists:get_value(description, Props), 24 | Author = proplists:get_value(author, Props, Username), 25 | 26 | Params = string:join(lists:map(fun({Key, Val}) -> 27 | Key ++ "=" ++ edoc_lib:escape_uri(Val) 28 | end, [{"username", Username}, 29 | {"md5", FinalMd5}, 30 | {"name", Name}, 31 | {"version", Vsn}, 32 | {"categories", Categories}, 33 | {"description", Desc}, 34 | {"author", Author}, 35 | {"package", base64:encode_to_string(Content)}]), [$&]), 36 | 37 | {ok, {_, _, Response}} = http:request(post, {"http://ecomponents.erlang-web.org/cgi-bin/add.py", 38 | [{"content-length", integer_to_list(length(Params))}, 39 | {"user-agent", escript:script_name()}], 40 | "application/x-www-form-urlencoded", Params}, 41 | [], []), 42 | io:format("~s~n", [Response]); 43 | action(_) -> 44 | print_usage(). 45 | 46 | create_package(Name, Path) -> 47 | TarName = "/tmp/" ++ Name ++ ".tar.gz", 48 | erl_tar:create(TarName, [Path], [compressed]), 49 | TarName. 50 | 51 | read_package(Path) -> 52 | {ok, Binary} = file:read_file(Path), 53 | file:delete(Path), 54 | binary_to_list(Binary). 55 | 56 | hash(String) -> 57 | lists:flatten(lists:reverse(lists:foldl(fun(X, Acc) -> 58 | int_to_hex(X, Acc) 59 | end, [], String))). 60 | 61 | int_to_hex(X, Acc) when X < 256 -> 62 | [[hex(X div 16), hex(X rem 16)] | Acc]. 63 | 64 | hex(X) when X < 10 -> 65 | $0 + X; 66 | hex(X) -> 67 | $a + (X-10). 68 | 69 | print_usage() -> 70 | io:format("Usage: bin/e_component_uploader.erl add Path~n" 71 | "where Path specifies the path to the valid Erlang application~n" 72 | "adds the component to the e_component repository~n"). 73 | -------------------------------------------------------------------------------- /bin/prepare.erl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | 3 | main([]) -> 4 | prepare_paths(), 5 | make:all(). 6 | 7 | prepare_paths() -> 8 | {ok, Libs} = file:list_dir("lib"), 9 | 10 | lists:foreach(fun(Lib) -> 11 | Path = filename:join(["lib", Lib, "ebin"]), 12 | code:add_path(Path) 13 | end, lists:delete(".svn", Libs)). 14 | -------------------------------------------------------------------------------- /bin/tarball.erl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | 3 | -include_lib("kernel/include/file.hrl"). 4 | 5 | main([]) -> 6 | Name = string:strip(io:get_line("Name of the tarball: "), both, 10), 7 | Url = string:strip(io:get_line("SVN address: "), both, 10), 8 | main([Name, Url]); 9 | main([Name, URL]) -> 10 | Path = export_svn(URL, Name), 11 | generate_pdf(Name, Path), 12 | 13 | Tarball = create_tarball(Name, Path), 14 | calculate_checksum(Tarball), 15 | 16 | clean_up(Path). 17 | 18 | export_svn(URL, Name) -> 19 | Path = filename:join(["/tmp", 20 | pid_to_list(self()), 21 | Name]), 22 | file:make_dir(filename:join("/tmp", 23 | pid_to_list(self()))), 24 | 25 | os:cmd(io_lib:format("svn export ~p ~p", [URL, Path])), 26 | 27 | message("SVN version exported."), 28 | 29 | Path. 30 | 31 | generate_pdf(Name, Path) -> 32 | DocPath = filename:join(Path, "doc"), 33 | PDFName = filename:join(DocPath, Name ++ ".pdf"), 34 | 35 | os:cmd(io_lib:format("make -C ~p", [DocPath])), 36 | 37 | file:rename(filename:join(DocPath, "skeleton.pdf"), 38 | PDFName), 39 | message("PDF generated"), 40 | 41 | clean_tex(DocPath, PDFName). 42 | 43 | clean_tex(Path, PDF) -> 44 | {ok, Dir} = file:list_dir(Path), 45 | lists:foreach(fun(F) -> 46 | delete_file(filename:join(Path, F), PDF) 47 | end, Dir), 48 | 49 | message("PDF cleaning up completed"). 50 | 51 | delete_file(PDF, PDF) -> 52 | ok; 53 | delete_file(File, PDF) -> 54 | {ok, FileInfo} = file:read_file_info(File), 55 | case FileInfo#file_info.type of 56 | directory -> 57 | {ok, Dir} = file:list_dir(File), 58 | lists:foreach(fun(F) -> 59 | delete_file(filename:join(File, F), PDF) 60 | end, Dir), 61 | 62 | file:del_dir(File); 63 | _ -> 64 | file:delete(File) 65 | end. 66 | 67 | create_tarball(Name, Path) -> 68 | Result = Name ++ ".tar.gz", 69 | 70 | os:cmd(io_lib:format("tar -czf ~p ~p", [Result, Path])), 71 | 72 | message("Creating tar.gz completed"), 73 | Result. 74 | 75 | calculate_checksum(Tarball) -> 76 | Md5 = hd(string:tokens(os:cmd("md5sum " ++ Tarball), " ")), 77 | Sha1 = hd(string:tokens(os:cmd("sha1sum " ++ Tarball), " ")), 78 | 79 | io:format("MD5: ~s~nSHA1: ~s~n", [Md5, Sha1]). 80 | 81 | clean_up(Path) -> 82 | {ok, Dir} = file:list_dir(Path), 83 | lists:foreach(fun(F) -> 84 | delete_file(filename:join(Path, F), "not used") 85 | end, Dir), 86 | 87 | message("Cleaning up completed"). 88 | 89 | message(Msg) -> 90 | io:format("~s~n", [Msg]). 91 | -------------------------------------------------------------------------------- /doc/DOC: -------------------------------------------------------------------------------- 1 | Visit http://wiki.erlang-web.org for the documentation. 2 | -------------------------------------------------------------------------------- /doc/NEXT_RELEASE: -------------------------------------------------------------------------------- 1 | 1.4.2 2 | ===== 3 | 4 | * wpart_my_primitive_type:load_tpl() is called automatically for 5 | all user-defined primitive types on application startup. 6 | - you don't have to do it yourself anymore 7 | - make sure that you implement load_tpl 8 | (it's required by wpart behaviour, anyway) 9 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/Emakefile: -------------------------------------------------------------------------------- 1 | {'src/*',[{outdir, "ebin"}, 2 | {i, "include"}, 3 | {i, "../yaws-1.85/include"}, 4 | debug_info, strict_record_tests, netload]}. 5 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/README: -------------------------------------------------------------------------------- 1 | Customize project.conf and dispatch.conf with delegates. Move to config folder on project level. -------------------------------------------------------------------------------- /lib/eptic-1.4.1/doc/overview.edoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/eptic-1.4.1/doc/overview.edoc -------------------------------------------------------------------------------- /lib/eptic-1.4.1/ebin/eptic.app: -------------------------------------------------------------------------------- 1 | {application, eptic, [ 2 | {description, "Eptic Erlang Web application"}, 3 | {vsn, "1.4.1"}, 4 | {modules, [e_cache,e_cluster,e_conf,e_error, 5 | e_db_couchdb,e_db,e_db_mnesia, 6 | e_dict,e_dispatcher,e_file,e_json,e_lang,e_hook, 7 | e_mod_gen,e_mod_inets,e_mod_yaws,e_mod_ewgi,e_multipart_common,e_multipart_inets,e_multipart_yaws, 8 | eptic,e_session,e_validator,e_component,e_cache_ets,e_cache_disk,e_annotation,e_user_annotation, 9 | e_logger, e_logger_viewer, 10 | e_start]}, 11 | {applications, [kernel, stdlib]}, 12 | {registered, []}, 13 | {env, [ 14 | {upload_dir, "/tmp"}, 15 | {template_root, "templates"}, 16 | {node_type, single_node}, 17 | {mime_types,[{"xml","text/xml"}, 18 | {"txt","text/plain"}, 19 | {"html","text/html"}, 20 | {"htm","text/html"}, 21 | {"css","text/css"}, 22 | {"png","image/png"}, 23 | {"jpeg","image/jpeg"}, 24 | {"jpg","image/jpeg"}, 25 | {"jpe","image/jpeg"}, 26 | {"gif","image/gif"}, 27 | {"bmp","image/bmp"}, 28 | {"zip","application/zip"}, 29 | {"tar","application/x-tar"}, 30 | {"js","application/x-javascript"}, 31 | {"pdf","application/pdf"}, 32 | {"ico","image/x-icon"}]} 33 | ]}, 34 | {mod, {eptic, []}} 35 | ]}. 36 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/include/e_annotation.hrl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : e_annotation.hrl 18 | %%% @author Michal Ptaszek 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -compile({parse_transform, e_annotation}). 22 | 23 | -define(BEFORE, 24 | -ew_annotation_before([])). 25 | 26 | -define(AFTER, 27 | -ew_annotation_after([])). 28 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/include/e_db_couchdb.hrl: -------------------------------------------------------------------------------- 1 | -define(CDB_READ_ALL_MAP(Prefix), 2 | "function(doc) {" 3 | " if(doc._id.indexOf('" ++ Prefix ++ "') == 0) {" 4 | " emit(doc, null);" 5 | " }" 6 | "}"). 7 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/include/eptic.hrl: -------------------------------------------------------------------------------- 1 | -define(ERR(Msg), 2 | io_lib:format("\n" 3 | "\n" 4 | "\n" 5 | "

An Error Occured:

\n" 6 | "
~s
\n" 7 | "
\nErlang Web 1.4.1\n" 8 | "\n", [Msg])). 9 | 10 | -define(VALIDATION(Msg), 11 | ["\n" 12 | "\n" 13 | "\n" 14 | "

Validation violation:

\n" 15 | "
",Msg,"
\n" 16 | "
\nErlang Web 1.4.1\n" 17 | "\n"]). 18 | 19 | -define(XHTML_HEADER, 20 | "\n" 21 | "\n"). 25 | 26 | -define(COOKIE, "eptic_cookie"). 27 | 28 | -define(ExtendTime_default, (30*60)). 29 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/include/s_vfs.hrl: -------------------------------------------------------------------------------- 1 | -record(s_vfs_file, 2 | {filename, % string 3 | content, % binary 4 | meta % #s_meta 5 | }). 6 | 7 | -record(s_meta, 8 | {mtime, % The local time the file was last written. 9 | mimetype, % MIME-TYPE 10 | size % size of the content 11 | }). 12 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/priv/errors.conf: -------------------------------------------------------------------------------- 1 | {not_existing, "Atom does not exist"}. 2 | {bad_bool_value, "The checkbox' selection is wrong"}. 3 | {wrong_value_in_set, "The provided value is invalid"}. 4 | {bad_date_format, "The date is badly formatted"}. 5 | {bad_separator_in_date_form, "Bad separator in date form"}. 6 | {bad_range, "The input is out of range"}. 7 | {bad_date, "The date is invalid"}. 8 | {bad_time, "The time is invalid"}. 9 | {bad_input, "The format could not be recognized"}. 10 | {no_such_enum_value, "The provided value is invalid"}. 11 | {smaller_than_min, "The value is too small"}. 12 | {greater_than_max, "The value is too big"}. 13 | {not_float, "The entered value is not a float"}. 14 | {not_integer, "The entered value is not an integer"}. 15 | {too_short, "The entered text is too short"}. 16 | {too_long, "The entered text is too long"}. 17 | {regexp_does_not_match, "The entered text does not match the pattern"}. 18 | {passwords_do_not_match, "The passwords do not match"}. 19 | {bad_time_format, "The time is badly formatted"}. 20 | {bad_separator_in_time_form, "Bad separator in time form"}. 21 | {bad_extension, "The file has bad extension"}. 22 | {too_big, "The file is too big"}. 23 | {empty_input, "The input could not be empty"}. 24 | {not_all_mandatory_fields_checked, "Not all mandatory fields checked"}. 25 | {bad_format, "Bad format"}. 26 | {element_not_unique, "Element must be unique"}. -------------------------------------------------------------------------------- /lib/eptic-1.4.1/priv/ewgi_inets.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | # change to e_fe_mod_inets in case of running in frontend or single_node_with_cache mode 6 | # Modules e_mod_inets mod_get mod_head mod_log 7 | Modules ewgi_inets mod_get mod_head mod_log 8 | Port 8080 9 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/priv/ewgi_inets_https.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb_https 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | Modules ewgi_inets mod_get mod_head mod_log 6 | Port 8081 7 | SocketType ssl 8 | %% place path to your certificate here 9 | SSLCertificateFile /home/insane/development/erlangweb-1.3/host.cert 10 | %% place path to your key file here 11 | SSLCertificateKeyFile /home/insane/development/erlangweb-1.3/host.key 12 | SSLVerifyClient 0 13 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/priv/inets.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | # change to e_fe_mod_inets in case of running in frontend or single_node_with_cache mode 6 | # Modules e_mod_inets mod_get mod_head mod_log 7 | Modules e_mod_inets mod_get mod_head mod_log 8 | Port 8080 9 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/priv/inets_https.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb_https 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | Modules e_mod_inets mod_get mod_head mod_log 6 | Port 8081 7 | %% SocketType ssl 8 | %% place path to your certificate here 9 | %% SSLCertificateFile /path/to/your/cert/file 10 | %% place path to your key file here 11 | %% SSLCertificateKeyFile /path/to/your/key/file 12 | %% SSLVerifyClient 0 13 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/src/e_cache.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : e_cache.erl 18 | %%% @author Michal Ptaszek 19 | %%% @doc Interface module for managing both: 20 | %%% 24 | %%% The XML parsed structure cache implementation could be changed 25 | %%% in the project.conf file, by placing a proper parameter: 26 | %%% {template_cache, Type} where Type is either 27 | %%% disk or ets (by default it is set to ets). 28 | %%% @end 29 | %%%------------------------------------------------------------------- 30 | -module(e_cache). 31 | -export([read_file/1, install/0]). 32 | 33 | %% 34 | %% @spec read_file(Filename :: string()) -> XmlStructure :: term() 35 | %% @doc Returns the content of the file parsed by the chosen XML parser. 36 | %% If the file content is not found in the cache, the file is read and 37 | %% put there. 38 | %% @end 39 | %% 40 | -spec(read_file/1 :: (string()) -> term()). 41 | read_file(Filename) -> 42 | e_logger:log({?MODULE, {reading_file, Filename}}), 43 | Mod = e_conf:template_cache_mod(), 44 | Mod:read_file(Filename, e_conf:template_expander()). 45 | 46 | %% @hidden 47 | -spec(install/0 :: () -> none()). 48 | install() -> 49 | case e_conf:template_cache_mod() of 50 | e_cache_ets -> 51 | e_cache_ets:install(); 52 | _ -> 53 | ok 54 | end. 55 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/src/e_error.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @since 1.3 18 | %%% @author Michal Ptaszek 19 | %%% @doc Module that deals with framework's error representation and translation. 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(e_error). 23 | 24 | -export([save/2, description/1]). 25 | 26 | -define(ERROR_KEY, "__errors"). 27 | 28 | -spec(save/2 :: (string(), term()) -> true). 29 | save(Field, Error) -> 30 | eptic:fset(?ERROR_KEY, Field, element(1, Error)). 31 | 32 | -spec(description/1 :: (string()) -> string()). 33 | description(Field) -> 34 | case eptic:fget(?ERROR_KEY, Field) of 35 | undefined -> 36 | []; 37 | Error -> 38 | e_lang:translate(errors, Error) 39 | end. 40 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/src/e_multipart_common.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : e_multipart_common.erl 18 | %%% Author : Krzysztof Goj 19 | %%% Description : Module responsible for server-agnostic things 20 | %%% in multipart form handling 21 | %%% @hidden 22 | %%%------------------------------------------------------------------- 23 | 24 | -module(e_multipart_common). 25 | 26 | %% API 27 | -export([base_dir/1, delete_tmp_files/1]). 28 | 29 | %%==================================================================== 30 | %% API 31 | %%==================================================================== 32 | 33 | %% 34 | %% @doc Returns path to process-specific directory into which files 35 | %% can be stored. This directory will be pruned when process terminates 36 | %% 37 | -spec(base_dir/1 :: (pid()) -> string()). 38 | base_dir(Pid) -> 39 | % remove angle brackets as they mess up docbuilder 40 | "<" ++ SafePid = pid_to_list(Pid) -- ">", 41 | LastDir = "e-multipart-" ++ SafePid, 42 | filename:join(e_conf:upload_dir(), LastDir). 43 | 44 | %% 45 | %% @doc Deletes the directory {@link base_dir/1} with all it's files 46 | %% 47 | -spec(delete_tmp_files/1 :: (pid()) -> ok | {error, atom()}). 48 | delete_tmp_files(Pid) -> 49 | Dirname = base_dir(Pid), 50 | lists:foreach(fun file:delete/1, 51 | filelib:wildcard(filename:join(Dirname, "*"))), 52 | file:del_dir(Dirname). 53 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/src/e_validator.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : e_validator.erl 18 | %%% Author : Martin 19 | %%% Michal 20 | %%% Description : Eptic Validator 21 | %%% @hidden 22 | %%%------------------------------------------------------------------- 23 | -module(e_validator). 24 | 25 | %% API 26 | -export([email/1]). 27 | 28 | %%==================================================================== 29 | %% API 30 | %%==================================================================== 31 | %%-------------------------------------------------------------------- 32 | %% Function: 33 | %% Description: 34 | %%-------------------------------------------------------------------- 35 | email(Value) -> 36 | case re:run(Value, "^(([A-Za-z\.]|_|-)+@[A-Za-z]+\.[A-Za-z\.]+[a-z])$", 37 | [{capture, first, list}]) of 38 | nomatch -> 39 | throw(exception_not_email_address); 40 | _ -> 41 | Value 42 | end. 43 | 44 | %%==================================================================== 45 | %% Internal functions 46 | %%==================================================================== 47 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/tests/Emakefile: -------------------------------------------------------------------------------- 1 | {'*', [{outdir, "../ebin"}, {i, "../include"}, debug_info, strict_record_tests, netload]}. 2 | -------------------------------------------------------------------------------- /lib/eptic-1.4.1/tests/cache_performance_test.erl: -------------------------------------------------------------------------------- 1 | -module(cache_performance_test). 2 | 3 | -export([cache_test/0]). 4 | 5 | -define(ADDRESSES, 6 | ["404.html", 7 | "about.html", 8 | "crud.html", 9 | "base.html", 10 | "getting_started_quickly.html", 11 | "main_page.html", 12 | "klacke.html", 13 | "enoent.html", 14 | "downloads.html", 15 | "filled_base.html", 16 | "501.html", 17 | "users/create_users.html", 18 | "users/update_users.html", 19 | "login/warning.html"]). 20 | 21 | -define(RETRIES, 10000). 22 | 23 | cache_test() -> 24 | e_dict:init_state([]), 25 | 26 | {A, B, C} = now(), 27 | random:seed(A, B, C), 28 | 29 | T1 = now(), 30 | test_file_cache(?RETRIES, ?ADDRESSES, length(?ADDRESSES)), 31 | T2 = now(), 32 | DT1 = timer:now_diff(T2, T1), 33 | 34 | T3 = now(), 35 | test_ets_cache(?RETRIES, ?ADDRESSES, length(?ADDRESSES)), 36 | T4 = now(), 37 | DT2 = timer:now_diff(T4, T3), 38 | 39 | io:format("File cache: ~p~nEts cache: ~p~n", [DT1, DT2]). 40 | 41 | test_file_cache(0, _, _) -> 42 | ok; 43 | test_file_cache(N, Addresses, Len) -> 44 | e_cache:read_file(lists:nth(random:uniform(Len), Addresses)), 45 | test_file_cache(N-1, Addresses, Len). 46 | 47 | test_ets_cache(0, _, _) -> 48 | ok; 49 | test_ets_cache(N, Addresses, Len) -> 50 | e_ets_cache:read_file(lists:nth(random:uniform(Len), Addresses)), 51 | test_ets_cache(N-1, Addresses, Len). 52 | 53 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/doc/overview.edoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/eptic_fe-1.0/doc/overview.edoc -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/ebin/eptic_fe.app: -------------------------------------------------------------------------------- 1 | %%% =================================================================== 2 | %%% @author Michal Ptaszek 3 | %%% @copyright (C) 2009 Erlang Training & Consulting Ltd. 4 | %%% =================================================================== 5 | {application, eptic_fe, 6 | [{description, "Frontend Erlang Web application"}, 7 | {vsn, "1.0"}, 8 | {modules, [eptic_fe,e_fe_cache,e_fe_gc,e_fe_proxy,e_fe_mod_yaws,e_fe_mod_inets,e_fe_mod_gen,e_fe_cluster]}, 9 | {registered,[]}, 10 | {env,[]}, 11 | {applications, [kernel, stdlib, sasl, eptic, wpart, wparts]}, 12 | {mod, {eptic_fe,[]}}]}. 13 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/priv/inets.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb_fe 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | Modules e_fe_mod_inets mod_get mod_head mod_log 6 | Port 8080 7 | MaxClients 5000 -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/priv/inets_https.conf: -------------------------------------------------------------------------------- 1 | ServerName erlangweb_fe_https 2 | ServerRoot docroot 3 | DocumentRoot docroot 4 | BindAddress * 5 | Modules e_fe_mod_inets mod_get mod_head mod_log 6 | Port 8081 7 | SocketType ssl 8 | %% place path to your certificate here 9 | SSLCertificateFile /home/michalp/dev/erlang_org/branches/erlangorg_2/priv/keys/host.cert 10 | %% place path to your key file here 11 | SSLCertificateKeyFile /home/michalp/dev/erlang_org/branches/erlangorg_2/priv/keys/host.key 12 | SSLVerifyClient 0 13 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/priv/yaws.conf: -------------------------------------------------------------------------------- 1 | 2 | # conf for yaws 3 | 4 | 5 | # first we have a set of globals 6 | # That apply to all virtual servers 7 | 8 | 9 | # This is the directory where all logfiles for 10 | # all virtual servers will be written 11 | 12 | logdir = log 13 | 14 | # This the path to a directory where additional 15 | # beam code can be placed. The daemon will add this 16 | # directory to its search path 17 | 18 | ebin_dir = lib/yaws/ebin 19 | 20 | # This is a directory where application specific .hrl 21 | # files can be placed. application specifig .yaws code can 22 | # then include these .hrl files 23 | 24 | include_dir = lib/yaws/include 25 | 26 | # This is a debug variable, possible values are http | traffic | false 27 | # It is also possible to set the trace (possibly to the tty) while 28 | # invoking yaws from the shell as in 29 | # yaws -i -T -x (see man yaws) 30 | 31 | trace = false 32 | 33 | # it is possible to have yaws start additional 34 | # application specific code at startup 35 | # 36 | # runmod = mymodule 37 | 38 | # By default yaws will copy the erlang error_log and 39 | # end write it to a wrap log called report.log (in the logdir) 40 | # this feature can be turned off. This would typically 41 | # be the case when yaws runs within another larger app 42 | 43 | copy_error_log = true 44 | 45 | # Logs are wrap logs 46 | 47 | log_wrap_size = 1000000 48 | 49 | # Possibly resolve all hostnames in logfiles so webalizer 50 | # can produce the nice geography piechart 51 | 52 | log_resolve_hostname = false 53 | 54 | # fail completely or not if yaws fails 55 | # to bind a listen socket 56 | fail_on_bind_err = true 57 | 58 | # If yaws is started as root, it can, once it has opened 59 | # all relevant sockets for listening, change the uid to a 60 | # user with lower accessrights than root 61 | 62 | # username = nobody 63 | 64 | # If HTTP auth is used, it is possible to have a specific 65 | # auth log. 66 | 67 | auth_log = true 68 | 69 | 70 | # When we're running multiple yaws systems on the same 71 | # host, we need to give each yaws system an individual 72 | # name. Yaws will write a number of runtime files under 73 | # /tmp/yaws/${id} 74 | # The default value is "default" 75 | 76 | 77 | # id = myname 78 | 79 | # earlier versions of Yaws picked the first virtual host 80 | # in a list of hosts with the same IP/PORT when the Host: 81 | # header doesn't match any name on any Host 82 | # This is often nice in testing environments but not 83 | # acceptable in real live hosting scenarios 84 | 85 | pick_first_virthost_on_nomatch = true 86 | 87 | 88 | # All unices are broken since it's not possible to bind to 89 | # a privileged port (< 1024) unless uid==0 90 | # There is a contrib in jungerl which makes it possible by means 91 | # of an external setuid root programm called fdsrv to listen to 92 | # to privileged port. 93 | # If we use this feature, it requires fdsrv to be properly installed. 94 | # Doesn't yet work with SSL. 95 | 96 | use_fdsrv = false 97 | 98 | id = erlangweb 99 | 100 | # end then a set of virtual servers 101 | # First two virthosted servers on the same IP (0.0.0.0) 102 | # in this case, but an explicit IP can be given as well 103 | 104 | 105 | port = 8080 106 | listen = 0.0.0.0 107 | docroot = docroot 108 | arg_rewrite_mod = e_fe_mod_yaws 109 | appmods = 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/src/e_fe_cluster.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : e_fe_cluster.erl 18 | %%% @author Michal Ptaszek 19 | %%% @doc Module responsible for managing the frontend nodes of the Erlang Web cluster. 20 | %%% All the functions should be called on the frontend server. 21 | %%% @end 22 | %%%------------------------------------------------------------------- 23 | -module(e_fe_cluster). 24 | 25 | -export([write_file/2, write_file_chunk/2]). 26 | 27 | %% 28 | %% @spec write_file(Filename :: string(), Content :: binary()) -> ok | {error, Reason :: atom()} 29 | %% @doc Saves the passed Content under the Filename on the frontend node. 30 | %% The previous version of the file is erased. 31 | %% 32 | -spec(write_file/2 :: (string(), binary()) -> ok | {error, atom()}). 33 | write_file(Filename, Content) -> 34 | file:write_file(Filename, Content). 35 | 36 | %% 37 | %% @spec write_file_chunk(Filename :: string(), Chunk :: binary()) -> ok 38 | %% @doc Appends the Content to the end of the file specified by Filename. 39 | %% If file does not exist, it is created. 40 | %% 41 | -spec(write_file_chunk/2 :: (string, binary()) -> ok). 42 | write_file_chunk(Filename, Content) -> 43 | case file:open(Filename, [append, raw]) of 44 | {ok, Fd} -> 45 | file:write(Fd, Content), 46 | file:close(Fd); 47 | {error, Reason} -> 48 | error_logger:error_msg("~p module, error during opening ~p file, reason: ~p~n", 49 | [?MODULE, Filename, Reason]) 50 | end. 51 | 52 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/src/e_fe_gc.erl: -------------------------------------------------------------------------------- 1 | %% the contents of this file are subject to the erlang web public license, 2 | %% version 1.0, (the "license"); you may not use this file except in 3 | %% compliance with the license. you should have received a copy of the 4 | %% erlang web public license along with this software. if not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% software distributed under the license is distributed on an "as is" 8 | %% basis, without warranty of any kind, either express or implied. see 9 | %% the license for the specific language governing rights and limitations 10 | %% under the license. 11 | %% 12 | %% the initial developer of the original code is erlang training & consulting 13 | %% ltd. portions created by erlang training & consulting ltd are copyright 2008, 14 | %% erlang training & consulting ltd. all rights reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% file : e_fe_gc.erl 18 | %%% @author Michal Ptaszek 19 | %%%------------------------------------------------------------------- 20 | -module(e_fe_gc). 21 | -export([start_link/0, init/0]). 22 | -export([collect_timeout/1, clear_timeout_cache/0]). 23 | 24 | %% @hidden 25 | start_link() -> 26 | Pid = spawn_link(?MODULE, init, []), 27 | register(?MODULE, Pid), 28 | {ok, Pid}. 29 | 30 | %% @hidden 31 | init() -> 32 | timer:apply_after(60000, e_fe_gc, clear_timeout_cache, []), 33 | case ets:lookup(e_fe_conf, gc_mode) of 34 | [] -> 35 | timer:apply_after(60000, e_fe_gc, collect_timeout, [60000]), 36 | timeout_loop(); 37 | [{_, {timeout, Mins}}] -> 38 | timer:apply_after(60000 * Mins, e_fe_gc, collect_timeout, [60000 * Mins]), 39 | timeout_loop(); 40 | [{_, {hits, Hits}}] -> 41 | hits_loop(Hits, Hits) 42 | end. 43 | 44 | -spec(timeout_loop/0 :: () -> none()). 45 | timeout_loop() -> 46 | receive 47 | _ -> 48 | timeout_loop() 49 | end. 50 | 51 | -spec(hits_loop/2 :: (integer(), integer()) -> none()). 52 | hits_loop(0, Default) -> 53 | collect(), 54 | hits_loop(Default, Default); 55 | hits_loop(Hits, Default) -> 56 | receive 57 | hit -> 58 | hits_loop(Hits-1, Default) 59 | end. 60 | 61 | -spec(collect/0 :: () -> swap). 62 | collect() -> 63 | {_, Second} = e_fe_cache:get_order(), 64 | ets:delete_all_objects(Second), 65 | 66 | e_fe_cache ! swap. 67 | 68 | -spec(collect_timeout/1 :: (integer()) -> none()). 69 | collect_timeout(T) -> 70 | collect(), 71 | timer:apply_after(T, e_fe_gc, collect_timeout, [T]). 72 | 73 | -spec(clear_timeout_cache/2 :: (integer(), list(tuple())) -> ok). 74 | clear_timeout_cache(_, []) -> 75 | ok; 76 | clear_timeout_cache(Time, [{URL, _, _, MaxTime, InsertionTime} | Rest]) -> 77 | Diff = timer:now_diff(Time, InsertionTime), 78 | if 79 | Diff div 1000000 >= MaxTime -> 80 | ets:delete(cache_timeout, URL); 81 | true -> 82 | ok 83 | end, 84 | 85 | clear_timeout_cache(Time, Rest). 86 | 87 | -spec(clear_timeout_cache/0 :: () -> none()). 88 | clear_timeout_cache() -> 89 | Now = now(), 90 | Cached = ets:tab2list(cache_timeout), 91 | 92 | clear_timeout_cache(Now, Cached), 93 | 94 | timer:apply_after(60000, e_fe_gc, clear_timeout_cache, []). 95 | -------------------------------------------------------------------------------- /lib/eptic_fe-1.0/src/eptic_fe.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : eptic_fe.erl 18 | %%% @author Michal Ptaszek 19 | %%% @doc Main module for frontend Erlang Web application. 20 | %%%

It starts the separate application and the main supervisor of the 21 | %%% frontend node.

22 | %%%

Frontend application has access only to the session linked with 23 | %%% the passed cookie and to the arguments server uses (cookies, headers, etc).

24 | %%%

The main role for frontend is to be lightweight node for 25 | %%% caching the content returned from the backend.

26 | %%% @end 27 | %%%------------------------------------------------------------------- 28 | -module(eptic_fe). 29 | 30 | -behaviour(supervisor). 31 | -behaviour(application). 32 | 33 | %% API 34 | -export([start_link/0]). 35 | -export([load_conf/0]). 36 | 37 | %% Application callbacks 38 | -export([start/2, stop/1]). 39 | 40 | %% Supervisor callbacks 41 | -export([init/1]). 42 | 43 | -define(SERVER, ?MODULE). 44 | 45 | %% @hidden 46 | start(_, _) -> 47 | load_conf(), 48 | supervisor:start_link(eptic_fe, []). 49 | 50 | %% @hidden 51 | stop(_) -> 52 | ok. 53 | 54 | %%==================================================================== 55 | %% API functions 56 | %%==================================================================== 57 | start_link() -> 58 | load_conf(), 59 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 60 | 61 | %%==================================================================== 62 | %% Supervisor callbacks 63 | %%==================================================================== 64 | init([]) -> 65 | Proxy = {e_fe_proxy, {e_fe_proxy, start_link, []}, 66 | permanent, 1000, worker, dynamic}, 67 | 68 | Cache = {e_fe_cache, {e_fe_cache, start_link, []}, 69 | permanent, 2000, worker, dynamic}, 70 | 71 | GC = {e_fe_gc, {e_fe_gc, start_link, []}, 72 | permanent, 10000, worker, dynamic}, 73 | 74 | {ok,{{one_for_one, 1, 5}, [Proxy, Cache, GC]}}. 75 | 76 | %%==================================================================== 77 | %% Internal functions 78 | %%==================================================================== 79 | load_conf() -> 80 | ets:new(e_fe_conf, [public, named_table]), 81 | 82 | case file:consult("config/project_fe.conf") of 83 | {ok, Tuples} -> 84 | ets:insert(e_fe_conf, Tuples); 85 | {error, Reason} -> 86 | error_logger:error_msg("Error during reading the configuration file config/project_fe.conf, " 87 | "reason: ~p", [Reason]) 88 | end. 89 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/Emakefile: -------------------------------------------------------------------------------- 1 | {"src/erlydtl/*", [debug_info, {outdir, "ebin"}]}. 2 | {"src/tests/*", [debug_info, {outdir, "ebin"}]}. 3 | {"src/demo/*", [debug_info, {outdir, "ebin"}]}. 4 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/Makefile: -------------------------------------------------------------------------------- 1 | ERL=erl 2 | ERLC=erlc 3 | 4 | PARSER=src/erlydtl/erlydtl_parser 5 | APP=erlydtl.app 6 | 7 | all: $(PARSER).erl ebin/$(APP) 8 | $(ERL) -make 9 | 10 | ebin/$(APP): src/erlydtl/$(APP) 11 | cp $< $@ 12 | 13 | $(PARSER).erl: $(PARSER).yrl 14 | $(ERLC) -o src/erlydtl src/erlydtl/erlydtl_parser.yrl 15 | 16 | run: 17 | $(ERL) -pa ebin 18 | 19 | 20 | test: 21 | $(ERL) -noshell -pa ebin \ 22 | -s erlydtl_functional_tests run_tests \ 23 | -s erlydtl_dateformat_tests run_tests \ 24 | -s erlydtl_unittests run_tests \ 25 | -s init stop 26 | 27 | clean: 28 | rm -fv ebin/*.beam 29 | rm -fv ebin/$(APP) 30 | rm -fv erl_crash.dump $(PARSER).erl 31 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/README: -------------------------------------------------------------------------------- 1 | ErlyDTL 2 | ======= 3 | 4 | ErlyDTL implements most but not all of the Django Template Language. 5 | 6 | Project homepage: http://code.google.com/p/erlydtl/ 7 | 8 | 9 | Compilation 10 | ----------- 11 | 12 | To compile ErlyDTL, type "make" in this directory. 13 | 14 | 15 | Template compilation 16 | -------------------- 17 | 18 | Four ways: 19 | 20 | erlydtl:compile("/path/to/template.dtl", my_module_name) 21 | 22 | erlydtl:compile("/path/to/template.dtl", my_module_name, Options) 23 | 24 | erlydtl:compile(<<"{{ foo }}">>, my_module_name) 25 | 26 | erlydtl:compile(<<"{{ foo }}">>, my_module_name, Options) 27 | 28 | Options is a proplist possibly containing: 29 | 30 | out_dir - Directory to store generated .beam files. If not specified, no 31 | .beam files will be created. 32 | 33 | doc_root - Included template paths will be relative to this directory; 34 | defaults to the compiled template's directory. 35 | 36 | custom_tags_dir - Directory of DTL files (no extension) includable as tags. 37 | E.g. if $custom_tags_dir/foo contains "{{ bar }}", then 38 | "{{ foo bar=100 }}" will evaluate to "100". Get it? 39 | 40 | vars - Variables (and their values) to evaluate at compile-time rather than 41 | render-time. 42 | 43 | reader - {module, function} tuple that takes a path to a template and returns 44 | a binary with the file contents. Defaults to {file, read_file}. Useful 45 | for reading templates from a network resource. 46 | 47 | compiler_options - Proplist passed directly to compiler:forms/2 48 | 49 | force_recompile - Recompile the module even if the source's checksum has not 50 | changed. Useful for debugging. 51 | 52 | 53 | Usage (of a compiled template) 54 | ------------------------------ 55 | 56 | my_compiled_template:render(Variables) -> {ok, IOList} | {error, Err} 57 | 58 | Variables is a proplist, dict, gb_tree, or a parameterized module 59 | (whose method names correspond to variable names). The variable 60 | values can be atoms, strings, binaries, or (nested) variables. 61 | 62 | IOList is the rendered template. 63 | 64 | my_compiled_template:source() -> {FileName, CheckSum} 65 | 66 | Name and checksum of the original template file. 67 | 68 | my_compiled_template:dependencies() -> [{FileName, CheckSum}] 69 | 70 | List of names/checksums of templates included by the original template 71 | file. Useful for frameworks that recompile a template only when the 72 | template's dependencies change. 73 | 74 | 75 | Tests 76 | ----- 77 | 78 | From a Unix shell, run: 79 | 80 | make test 81 | 82 | Note that the tests will create some output in examples/rendered_output. 83 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/ebin/erlydtl.app: -------------------------------------------------------------------------------- 1 | %% -*- mode: erlang -*- 2 | {application, erlydtl, 3 | [{description, "ErlyDTL implements most but not all of the Django Template Language"}, 4 | {vsn, "0.5.3"}, 5 | {modules, [ 6 | erlydtl, 7 | erlydtl_compiler, 8 | erlydtl_dateformat, 9 | % erlydtl_dateformat_tests, 10 | erlydtl_deps, 11 | % erlydtl_example_variable_storage, 12 | erlydtl_filters, 13 | % erlydtl_functional_tests, 14 | erlydtl_parser, 15 | erlydtl_runtime, 16 | erlydtl_scanner 17 | % erlydtl_unittests 18 | ]}, 19 | {applications, [kernel, stdlib, crypto, syntax_tools, compiler]}, 20 | {registered, []} 21 | ]}. 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/autoescape: -------------------------------------------------------------------------------- 1 | {% autoescape on %} 2 | This is escaped: {{ var1 }} 3 | {% autoescape off %} 4 | This is not escaped: {{ var1 }} 5 | 6 | This is escaped: {{ var1|escape }} 7 | {% endautoescape %} 8 | {% endautoescape %} 9 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/base: -------------------------------------------------------------------------------- 1 | {{ base_var }} 2 | 3 | base template 4 | 5 | {% block title %}base title{% endblock %} 6 | 7 | more of base template 8 | 9 | {% block content %}base content{% endblock %} 10 | 11 | end of base template 12 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/comment: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test Comment 6 | 7 | 8 | {# comment1 #} 9 | bla 10 | {# comment2 #} 11 | blue 12 | {% comment %} 13 | Block Comment 14 | {% endcomment %} 15 | black 16 | 17 | 18 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/custom_call: -------------------------------------------------------------------------------- 1 | >>>> before custom call tag 'comment' 2 | {% call example_for_preset %} 3 | >>>> after custom call tag 'comment' 4 | 5 | >>>> before custom call tag 'if' 6 | {% call example_if with var1 %} 7 | >>>> after custom call tag 'if' -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/custom_tag: -------------------------------------------------------------------------------- 1 | {% load flashvideo %} 2 | 3 | 4 | 5 | 6 | Test variable 7 | 8 | 9 | before 10 | {% flashvideo dom_id="myvideo" width="800" height="600" static="/static" path_to_video="/myvid.mp4" path_to_preview_image="/mypic.jpg" %} 11 | after 12 | 13 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/custom_tag_error: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test variable 6 | 7 | 8 | before 9 | {% flashvideo dom_id="myvideo" width="800" height="600" static="/static" path_to_video="/myvid.mp4" path_to_preview_image="/mypic.jpg" %} 10 | after 11 | 12 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/cycle: -------------------------------------------------------------------------------- 1 | before 2 | 3 |
    4 | {% for i in test %} 5 |
  • {{ forloop.counter }}. {{ i }} - {% cycle a b c %}
  • 6 | {% endfor %} 7 |
8 | 9 | after 10 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/extends: -------------------------------------------------------------------------------- 1 | {% extends "base" %} 2 | {% block title %}replacing the base title{% endblock %} 3 | {% block content %}replacing the base content - variable: {{ test_var }} after variable {% endblock %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/extends_path: -------------------------------------------------------------------------------- 1 | {% extends "path1/base1" %} 2 | {% block title %}replacing the base title{% endblock %} 3 | {% block content %}replacing the base content - variable: {{ test_var }} after variable {% endblock %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/extends_path2: -------------------------------------------------------------------------------- 1 | {% extends "path1/base2" %} 2 | {% block content %} 3 | start_content 4 | {% include "path1/include1" %} 5 | end_content 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/filters: -------------------------------------------------------------------------------- 1 | Add: 2 + 2 = {{ 2|add:2 }} 2 | 3 | Capfirst: {{ "capitalized"|capfirst }} 4 | 5 | Centered: 6 |
 7 | {{ "center"|center:20 }}
 8 | 
9 | 10 | Date format: {{ date_var1|date:"r" }} 11 | DateTime format: {{ datetime_var1|date:"r" }} 12 | 13 | Escape JS: {{ "\" '"|escapejs }} 14 | 15 | First letter: {{ "first"|first }} 16 | 17 | Fix ampersands: {{ "&"|fix_ampersands }} 18 | 19 | Force_escape: {{ ""|force_escape }} 20 | 21 | Joined: {{ list|join:", " }} 22 | 23 | Last: {{ "last"|last }} 24 | 25 | Length: {{ list|length }} 26 | 27 | Length is 2?: {{ list|length_is:2 }} 28 | 29 | Left adjust: 30 |
31 | {{ "left"|ljust:20 }}
32 | 
33 | 34 | Line breaks: {{ "Line 1\nLine 2\nLine 3"|linebreaksbr }} 35 | 36 | Lowercase: {{ "LOWERCASE"|lower }} 37 | 38 | Right adjust: 39 |
40 | {{ "right"|rjust:20 }}
41 | 
42 | 43 | Uppercase: {{ "uppercase"|upper }} 44 | 45 | URL Encode: {{ "Let's go!"|urlencode }} 46 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for: -------------------------------------------------------------------------------- 1 | before 2 | 3 |
    4 | {% for iterator in fruit_list %} 5 |
  • {{ forloop.counter }}. {{ iterator }}
  • 6 | {% endfor %} 7 |
8 | 9 | after 10 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_list: -------------------------------------------------------------------------------- 1 | {% for singular, plural, price in fruit_list %} 2 | More than one {{ singular }} is called "{{ plural }}". Only {{ price }} each! 3 | {% endfor %} 4 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_list_preset: -------------------------------------------------------------------------------- 1 | {% for singular, plural in fruit_list %} 2 | More than one {{ singular }} is called "{{ plural }}". 3 | {% endfor %} 4 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_preset: -------------------------------------------------------------------------------- 1 | before 2 | 3 |
    4 | {% for iterator in fruit_list %} 5 |
  • {{ iterator }}
  • 6 | {% endfor %} 7 |
8 | 9 | after -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_records: -------------------------------------------------------------------------------- 1 | before 2 | 3 | 8 | 9 | after -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_records_preset: -------------------------------------------------------------------------------- 1 | before 2 | 3 | 8 | 9 | 14 | 15 | after -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/for_tuple: -------------------------------------------------------------------------------- 1 | {% for singular, plural in fruit_list %} 2 | One {{ singular }}, two {{ plural }}! 3 | {% endfor %} 4 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/if: -------------------------------------------------------------------------------- 1 | One but not two: {% if var1 %} one {% else %} two {% endif %} 2 | Two but not one: {% if not var1 %} one {% else %} two {% endif %} 3 | One: {% if var1 %} one {% endif %} 4 | None: {% if var2 %} one {% endif %} 5 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/if_preset: -------------------------------------------------------------------------------- 1 | One but not two: {% if var1 %} one {% else %} two {% endif %} 2 | Two but not one: {% if not var1 %} one {% else %} two {% endif %} 3 | One: {% if var1 %} one {% endif %} 4 | None: {% if var2 %} one {% endif %} 5 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/ifequal: -------------------------------------------------------------------------------- 1 | {% ifequal var1 var2 %} 2 | if: var1="foo" and var2="foo" are equal 3 | {% endifequal %} 4 | 5 | {% ifequal var1 var2 %} 6 | if: var1="foo" and var2="foo" are equal 7 | {% else %} 8 | else: var1="foo" and var2="foo" are not equal 9 | {% endifequal %} 10 | 11 | {% ifequal var1 var3 %} 12 | if: var1="foo" and var3="bar" are equal 13 | {% endifequal %} 14 | 15 | {% ifequal var1 var3 %} 16 | if: var1="foo" and var3="bar" are equal 17 | {% else %} 18 | else: var1="foo" and var3="bar" are not equal 19 | {% endifequal %} 20 | 21 | {% ifequal "foo" "foo" %} 22 | if: "foo" and "foo" are equal 23 | {% else %} 24 | else: "foo" and "foo" are not equal 25 | {% endifequal %} 26 | 27 | {% ifequal "foo" "bar" %} 28 | if: "foo" and "bar" are equal 29 | {% else %} 30 | else: "foo" and "bar" are not equal 31 | {% endifequal %} 32 | 33 | {% ifequal 99 99 %} 34 | if: 99 and 99 are equal 35 | {% else %} 36 | else: 99 and 99 are not equal 37 | {% endifequal %} 38 | 39 | {% ifequal 77 99 %} 40 | if: 77 and 99 are equal 41 | {% else %} 42 | else: 77 and 99 are not equal 43 | {% endifequal %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/ifequal_preset: -------------------------------------------------------------------------------- 1 | {% ifequal var1 var2 %} 2 | if: var1="foo" and var2="foo" are equal 3 | {% endifequal %} 4 | 5 | {% ifequal var1 var2 %} 6 | if: var1="foo" and var2="foo" are equal 7 | {% else %} 8 | else: var1="foo" and var2="foo" are not equal 9 | {% endifequal %} 10 | 11 | {% ifequal var1 var3 %} 12 | if: var1="foo" and var3="bar" are equal 13 | {% endifequal %} 14 | 15 | {% ifequal var1 var3 %} 16 | if: var1="foo" and var3="bar" are equal 17 | {% else %} 18 | else: var1="foo" and var3="bar" are not equal 19 | {% endifequal %} 20 | 21 | {% ifequal "foo" "foo" %} 22 | if: "foo" and "foo" are equal 23 | {% else %} 24 | else: "foo" and "foo" are not equal 25 | {% endifequal %} 26 | 27 | {% ifequal "foo" "bar" %} 28 | if: "foo" and "bar" are equal 29 | {% else %} 30 | else: "foo" and "bar" are not equal 31 | {% endifequal %} 32 | 33 | {% ifequal 99 99 %} 34 | if: 99 and 99 are equal 35 | {% else %} 36 | else: 99 and 99 are not equal 37 | {% endifequal %} 38 | 39 | {% ifequal 77 99 %} 40 | if: 77 and 99 are equal 41 | {% else %} 42 | else: 77 and 99 are not equal 43 | {% endifequal %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/ifnotequal: -------------------------------------------------------------------------------- 1 | {% ifnotequal var1 var2 %} 2 | if: var1="foo" and var2="foo" are equal 3 | {% endifnotequal %} 4 | 5 | {% ifnotequal var1 var2 %} 6 | if: var1="foo" and var2="foo" are equal 7 | {% else %} 8 | else: var1="foo" and var2="foo" are not equal 9 | {% endifnotequal %} 10 | 11 | {% ifnotequal var1 var3 %} 12 | if: var1="foo" and var3="bar" are equal 13 | {% endifnotequal %} 14 | 15 | {% ifnotequal var1 var3 %} 16 | if: var1="foo" and var3="bar" are equal 17 | {% else %} 18 | else: var1="foo" and var3="bar" are not equal 19 | {% endifnotequal %} 20 | 21 | {% ifnotequal "foo" "foo" %} 22 | if: "foo" and "foo" are equal 23 | {% else %} 24 | else: "foo" and "foo" are not equal 25 | {% endifnotequal %} 26 | 27 | {% ifnotequal "foo" "bar" %} 28 | if: "foo" and "bar" are equal 29 | {% else %} 30 | else: "foo" and "bar" are not equal 31 | {% endifnotequal %} 32 | 33 | {% ifnotequal 99 99 %} 34 | if: 99 and 99 are equal 35 | {% else %} 36 | else: 99 and 99 are not equal 37 | {% endifnotequal %} 38 | 39 | {% ifnotequal 77 99 %} 40 | if: 77 and 99 are equal 41 | {% else %} 42 | else: 77 and 99 are not equal 43 | {% endifnotequal %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/ifnotequal_preset: -------------------------------------------------------------------------------- 1 | {% ifnotequal var1 var2 %} 2 | if: var1="foo" and var2="foo" are equal 3 | {% endifnotequal %} 4 | 5 | {% ifnotequal var1 var2 %} 6 | if: var1="foo" and var2="foo" are equal 7 | {% else %} 8 | else: var1="foo" and var2="foo" are not equal 9 | {% endifnotequal %} 10 | 11 | {% ifnotequal var1 var3 %} 12 | if: var1="foo" and var3="bar" are equal 13 | {% endifnotequal %} 14 | 15 | {% ifnotequal var1 var3 %} 16 | if: var1="foo" and var3="bar" are equal 17 | {% else %} 18 | else: var1="foo" and var3="bar" are not equal 19 | {% endifnotequal %} 20 | 21 | {% ifnotequal "foo" "foo" %} 22 | if: "foo" and "foo" are equal 23 | {% else %} 24 | else: "foo" and "foo" are not equal 25 | {% endifnotequal %} 26 | 27 | {% ifnotequal "foo" "bar" %} 28 | if: "foo" and "bar" are equal 29 | {% else %} 30 | else: "foo" and "bar" are not equal 31 | {% endifnotequal %} 32 | 33 | {% ifnotequal 99 99 %} 34 | if: 99 and 99 are equal 35 | {% else %} 36 | else: 99 and 99 are not equal 37 | {% endifnotequal %} 38 | 39 | {% ifnotequal 77 99 %} 40 | if: 77 and 99 are equal 41 | {% else %} 42 | else: 77 and 99 are not equal 43 | {% endifnotequal %} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/include: -------------------------------------------------------------------------------- 1 | Including another file: {% include "include.html" %} 2 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/include.html: -------------------------------------------------------------------------------- 1 | This is included! {{ var1 }} 2 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/include_path: -------------------------------------------------------------------------------- 1 | main file 2 | 3 | {% include "path1/template1" %} 4 | 5 | {{ base_var }} -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/include_template: -------------------------------------------------------------------------------- 1 | Including another template: {% include "base" %} 2 | 3 | test variable: {{ test_var }} 4 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/now: -------------------------------------------------------------------------------- 1 | Expected format : Thu, 21 Dec 2000 16:01:07 +0200 2 | Got : {% now "r" %} 3 | 4 | Expected format : 27th February 2008 01:24 5 | Got : {% now "jS F Y H:i" %} 6 | 7 | Expected format : It is the 4th of September 2007 8 | Got : It is the {% now "jS o\f F Y" %} 9 | 10 | Expected format : '' 11 | Got : '{% now "" %}' 12 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path1/base1: -------------------------------------------------------------------------------- 1 | {% extends "path2/base2" %} 2 | 3 | {% block title2 %}block title 2 from base1 {% endblock %} 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path1/base2: -------------------------------------------------------------------------------- 1 | pre content 2 | 3 | {% block content %}default content{% endblock %} 4 | 5 | post 6 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path1/include1: -------------------------------------------------------------------------------- 1 | This is include1 2 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path1/template1: -------------------------------------------------------------------------------- 1 | This is template 1. 2 | 3 | {{ test_var }} 4 | 5 | {% include "path2/template2" %} 6 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path2/base2: -------------------------------------------------------------------------------- 1 | {{ base_var }} 2 | 3 | base2 template 4 | 5 | {% block title %}block title in base2, should be hidden by main template{% endblock %} 6 | {% block title2 %}block title2 in base2, should be hidden by base1{% endblock %} 7 | 8 | more of base2 template 9 | 10 | {% block content %}block content in base 2, should be overwritten{% endblock %} 11 | 12 | {% block content2 %}block content2 in base 2, should pass through{% endblock %} 13 | 14 | end of base2 template 15 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/path2/template2: -------------------------------------------------------------------------------- 1 | 2 | This is template 2 3 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/var: -------------------------------------------------------------------------------- 1 | before varriable1 2 | {{ var1 }} 3 | after variable1 4 | 5 | after variable2 (HTML-comment-wrapped) -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/var_error: -------------------------------------------------------------------------------- 1 | before varriable1 2 | {{ var1 }} 3 | after variable1 4 | 5 | after variable2 (HTML-comment-wrapped) -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/examples/docroot/var_preset: -------------------------------------------------------------------------------- 1 | one 2 | {{ var1 }} 3 | two 4 | {{ preset_var1 }} 5 | three 6 | 7 | four 8 | {{ preset_var2 }} 9 | five 10 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/priv/custom_tags/flashvideo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

To view the Video:

13 |

14 | 15 | Get Adobe Flash player 16 | 17 |

18 | 19 |
20 | 21 |
-------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/src/erlydtl/erlydtl.app: -------------------------------------------------------------------------------- 1 | %% -*- mode: erlang -*- 2 | {application, erlydtl, 3 | [{description, "ErlyDTL implements most but not all of the Django Template Language"}, 4 | {vsn, "0.5.3"}, 5 | {modules, [ 6 | erlydtl, 7 | erlydtl_compiler, 8 | erlydtl_dateformat, 9 | erlydtl_dateformat_tests, 10 | erlydtl_deps, 11 | erlydtl_example_variable_storage, 12 | erlydtl_filters, 13 | erlydtl_functional_tests, 14 | erlydtl_parser, 15 | erlydtl_runtime, 16 | erlydtl_scanner, 17 | erlydtl_unittests 18 | ]}, 19 | {applications, [kernel, stdlib, crypto]}, 20 | {registered, []} 21 | ]}. 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/src/erlydtl/erlydtl.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %%% File: erlydtl.erl 3 | %%% @author Roberto Saccon [http://rsaccon.com] 4 | %%% @author Evan Miller 5 | %%% @copyright 2008 Roberto Saccon, Evan Miller 6 | %%% @doc 7 | %%% Public interface for ErlyDTL 8 | %%% @end 9 | %%% 10 | %%% The MIT License 11 | %%% 12 | %%% Copyright (c) 2008 Roberto Saccon, Evan Miller 13 | %%% 14 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 15 | %%% of this software and associated documentation files (the "Software"), to deal 16 | %%% in the Software without restriction, including without limitation the rights 17 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | %%% copies of the Software, and to permit persons to whom the Software is 19 | %%% furnished to do so, subject to the following conditions: 20 | %%% 21 | %%% The above copyright notice and this permission notice shall be included in 22 | %%% all copies or substantial portions of the Software. 23 | %%% 24 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | %%% THE SOFTWARE. 31 | %%% 32 | %%% @since 2007-11-11 by Roberto Saccon, Evan Miller 33 | %%%------------------------------------------------------------------- 34 | -module(erlydtl). 35 | -author('rsaccon@gmail.com'). 36 | -author('emmiller@gmail.com'). 37 | 38 | %% API 39 | -export([compile/2, compile/3]). 40 | 41 | compile(FileOrBinary, Module) -> 42 | erlydtl_compiler:compile(FileOrBinary, Module). 43 | 44 | compile(FileOrBinary, Module, Options) -> 45 | erlydtl_compiler:compile(FileOrBinary, Module, Options). 46 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/src/erlydtl/erlydtl_deps.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %%% File: erlydtl_deps.erl 3 | %%% @author Roberto Saccon [http://rsaccon.com] 4 | %%% @author Evan Miller 5 | %%% @copyright 2008 Roberto Saccon, Evan Miller 6 | %%% @doc 7 | %%% ErlyDTL helper module 8 | %%% @end 9 | %%% 10 | %%% The MIT License 11 | %%% 12 | %%% Copyright (c) 2007 Roberto Saccon, Evan Miller 13 | %%% 14 | %%% Permission is hereby granted, free of charge, to any person obtaining a copy 15 | %%% of this software and associated documentation files (the "Software"), to deal 16 | %%% in the Software without restriction, including without limitation the rights 17 | %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | %%% copies of the Software, and to permit persons to whom the Software is 19 | %%% furnished to do so, subject to the following conditions: 20 | %%% 21 | %%% The above copyright notice and this permission notice shall be included in 22 | %%% all copies or substantial portions of the Software. 23 | %%% 24 | %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | %%% THE SOFTWARE. 31 | %%% 32 | %%% @since 2007-12-16 by Roberto Saccon, Evan Miller 33 | %%%------------------------------------------------------------------- 34 | -module(erlydtl_deps). 35 | -author('rsaccon@gmail.com'). 36 | -author('emmiller@gmail.com'). 37 | 38 | %% API 39 | -export([get_base_dir/0, get_base_dir/1]). 40 | 41 | %%==================================================================== 42 | %% API 43 | %%==================================================================== 44 | %% @spec get_base_dir(Module) -> string() 45 | %% @doc Return the application directory for Module. It assumes Module is in 46 | %% a standard OTP layout application in the ebin or src directory. 47 | get_base_dir(Module) -> 48 | {file, Here} = code:is_loaded(Module), 49 | filename:dirname(filename:dirname(Here)). 50 | 51 | %% @spec get_base_dir() -> string() 52 | %% @doc Return the application directory for this application. Equivalent to 53 | %% get_base_dir(?MODULE). 54 | get_base_dir() -> 55 | get_base_dir(?MODULE). 56 | 57 | %%==================================================================== 58 | %% Internal functions 59 | %%==================================================================== 60 | 61 | -------------------------------------------------------------------------------- /lib/erlydtl-0.5.3/src/tests/erlydtl_example_variable_storage.erl: -------------------------------------------------------------------------------- 1 | -module(erlydtl_example_variable_storage, [SomeVar]). 2 | -compile(export_all). 3 | 4 | some_var() -> 5 | SomeVar. 6 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/AUTHORS: -------------------------------------------------------------------------------- 1 | * Filippo Pacini 2 | * Hunter Morris 3 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/Emakefile: -------------------------------------------------------------------------------- 1 | % -*- mode: erlang -*- 2 | 3 | {["src/*"], 4 | [{i, "include"}, 5 | {outdir, "ebin"}, 6 | debug_info] 7 | }. 8 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/Makefile: -------------------------------------------------------------------------------- 1 | VSN := 0.2 2 | ERL ?= erl 3 | EBIN_DIRS := $(wildcard lib/*/ebin) 4 | APP := ewgi 5 | 6 | all: erl ebin/$(APP).app 7 | 8 | erl: ebin lib 9 | @$(ERL) -pa $(EBIN_DIRS) -pa ebin -noinput +B \ 10 | -eval 'case make:all() of up_to_date -> halt(0); error -> halt(1) end.' 11 | 12 | docs: 13 | @erl -noshell -run edoc_run application '$(APP)' '"."' '[]' 14 | 15 | clean: 16 | @echo "removing:" 17 | @rm -fv ebin/*.beam ebin/*.app 18 | 19 | ebin/$(APP).app: src/$(APP).app 20 | @cp -v src/$(APP).app $@ 21 | 22 | ebin: 23 | @mkdir ebin 24 | 25 | lib: 26 | @mkdir lib 27 | 28 | dialyzer: erl 29 | @dialyzer -c ebin 30 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/_build.cfg: -------------------------------------------------------------------------------- 1 | project : { 2 | name : ewgi 3 | vsn : "0.2" 4 | }, 5 | 6 | repositories : ["http://repo.erlware.org/pub"] 7 | 8 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/ebin/ewgi.app: -------------------------------------------------------------------------------- 1 | {application, ewgi, 2 | [{description, "Erlang Webserver Gateway Interface"} 3 | ,{registered, []} 4 | ,{vsn, "0.2"} 5 | ,{applications, [kernel, stdlib]} 6 | ,{env, []} 7 | ,{modules, [ewgi_api 8 | ,ewgi_test 9 | ,ewgi_inets 10 | ,ewgi_application 11 | ,ewgi_mochiweb 12 | ,ewgi_yaws 13 | ]} 14 | ]}. 15 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/src/ewgi.app: -------------------------------------------------------------------------------- 1 | {application, ewgi, 2 | [{description, "Erlang Webserver Gateway Interface"} 3 | ,{registered, []} 4 | ,{vsn, "0.2"} 5 | ,{applications, [kernel, stdlib]} 6 | ,{env, []} 7 | ,{modules, [ewgi_api 8 | ,ewgi_test 9 | ,ewgi_inets 10 | ,ewgi_application 11 | ,ewgi_mochiweb 12 | ,ewgi_yaws 13 | ]} 14 | ]}. 15 | -------------------------------------------------------------------------------- /lib/ewgi-0.2/src/ewgi_application.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %%% File : ewgi_application.erl 3 | %%% Authors : Filippo Pacini 4 | %%% Hunter Morris 5 | %%% License : 6 | %%% The contents of this file are subject to the Mozilla Public 7 | %%% License Version 1.1 (the "License"); you may not use this file 8 | %%% except in compliance with the License. You may obtain a copy of 9 | %%% the License at http://www.mozilla.org/MPL/ 10 | %%% 11 | %%% Software distributed under the License is distributed on an "AS IS" 12 | %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 13 | %%% the License for the specific language governing rights and 14 | %%% limitations under the License. 15 | %%% The Initial Developer of the Original Code is S.G. Consulting 16 | %%% srl. Portions created by S.G. Consulting s.r.l. are Copyright (C) 17 | %%% 2007 S.G. Consulting srl. All Rights Reserved. 18 | %%% 19 | %%% @doc 20 | %%%

ewgi application behaviour.

21 | %%% 22 | %%% @end 23 | %%% 24 | %%% Created : 22 May 2008 by Hunter Morris 25 | %%%------------------------------------------------------------------- 26 | -module(ewgi_application). 27 | 28 | %% Public API 29 | -export([run/2]). 30 | 31 | %% Useful middleware 32 | -export([module_mw/1, rpc_mw/3, mfa_mw/2]). 33 | 34 | -include_lib("ewgi.hrl"). 35 | 36 | %% @spec run(Application::ewgi_app(), Context::ewgi_context()) -> Context1::ewgi_context() 37 | %% @doc Runs an EWGI application with Context and returns the new Context1. 38 | -spec run(ewgi_app(), ewgi_context()) -> ewgi_context(). 39 | run(Application, Context) when is_function(Application, 1) -> 40 | Application(Context). 41 | 42 | %% @spec module_mw(Module::term()) -> ewgi_app() 43 | %% @doc Produces a middleware application which calls the handle/1 function exported by Module. 44 | -spec module_mw(any()) -> ewgi_app(). 45 | module_mw(Module) -> 46 | F = fun(Context) -> 47 | Module:handle(Context) 48 | end, 49 | F. 50 | 51 | %% @spec rpc_mw(Node::atom(), Module::atom(), Fun::atom()) -> ewgi_app() 52 | %% @doc Produces a middleware application which calls the remote function Module:Fun on Node. 53 | -spec rpc_mw(atom(), atom(), atom()) -> ewgi_app(). 54 | rpc_mw(Node, Module, Fun) -> 55 | F = fun(Context) -> 56 | rpc:call(Node, Module, Fun, [Context]) 57 | end, 58 | F. 59 | 60 | %% @spec mfa_mw(Module::atom(), Fun::atom()) -> ewgi_app() 61 | %% @doc Produces a middleware application which calls the function Module:Fun(Args) 62 | -spec mfa_mw(atom(), atom()) -> ewgi_app(). 63 | mfa_mw(Module, Fun) when is_atom(Module), is_atom(Fun) -> 64 | F = fun(Context) -> 65 | apply(Module, Fun, [Context]) 66 | end, 67 | F. 68 | -------------------------------------------------------------------------------- /lib/ewts-1.0/Emakefile: -------------------------------------------------------------------------------- 1 | {'src/*',[{outdir, "ebin"}, 2 | {i, "include"}, 3 | debug_info, strict_record_tests, netload]}. 4 | -------------------------------------------------------------------------------- /lib/ewts-1.0/doc/overview.edoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/ewts-1.0/doc/overview.edoc -------------------------------------------------------------------------------- /lib/ewts-1.0/ebin/ewts.app: -------------------------------------------------------------------------------- 1 | {application, ewts, 2 | [ 3 | {description, "Erlang Web Test Suite"}, 4 | {vsn, "1.0"}, 5 | {modules, [e_mod_ewts, 6 | ewts_client, 7 | ewts_dbg, 8 | ewts_sup, 9 | ewts_app, 10 | ewts]}, 11 | {registered, []}, 12 | {applications, [kernel, stdlib, eptic, wpart, wparts]}, 13 | {build_dependencies, []}, 14 | {mod, {ewts_app, []}}, 15 | {env, []} 16 | ]}. 17 | -------------------------------------------------------------------------------- /lib/ewts-1.0/include/request.hrl: -------------------------------------------------------------------------------- 1 | -type(string_proplist() :: list({string(), string()})). 2 | 3 | -record(request, { 4 | url :: string(), 5 | cookies = [] :: string_proplist(), 6 | post_args = [] :: string_proplist(), 7 | get_args = [] :: string_proplist(), 8 | protocol = http :: http | https 9 | %% TODO - add multipart? 10 | }). 11 | 12 | -record(response, { 13 | headers :: string_proplist(), 14 | code = 200 :: integer(), 15 | cookies :: string_proplist(), 16 | body = "" :: string(), 17 | req_dict :: list() 18 | }). 19 | 20 | -undef(assertDbg). 21 | -define(assertDbg(Expr, MinPassed), 22 | (fun() -> 23 | case Expr of 24 | {0, 0} -> 25 | ewts_dbg:clear(); 26 | {N, 0} when MinPassed =< N -> 27 | ewts_dbg:clear(); 28 | {N, M} -> 29 | ewts_dbg:clear(), 30 | erlang:error({assertDbg_failed, 31 | [{module, ?MODULE}, 32 | {line, ?LINE}, 33 | {expression, (??Expr)}, 34 | {dbg_tests_failed, (??M)}, 35 | {dbg_tests_passed, (??N)}]}) 36 | end 37 | end)()). 38 | -------------------------------------------------------------------------------- /lib/ewts-1.0/src/ewts_app.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : ewts_app.erl 18 | %%% Author : michalptaszek 19 | %%% Description : Main application of Erlang Web Testing Suite. 20 | %%% 21 | %%% Created : 16 Jun 2009 by michalptaszek 22 | %%%------------------------------------------------------------------- 23 | -module(ewts_app). 24 | 25 | -behaviour(application). 26 | 27 | %% Application callbacks 28 | -export([start/2, stop/1]). 29 | 30 | %%==================================================================== 31 | %% Application callbacks 32 | %%==================================================================== 33 | %%-------------------------------------------------------------------- 34 | %% Function: start(Type, StartArgs) -> {ok, Pid} | 35 | %% {ok, Pid, State} | 36 | %% {error, Reason} 37 | %% Description: This function is called whenever an application 38 | %% is started using application:start/1,2, and should start the processes 39 | %% of the application. If the application is structured according to the 40 | %% OTP design principles as a supervision tree, this means starting the 41 | %% top supervisor of the tree. 42 | %%-------------------------------------------------------------------- 43 | -spec(start/2 :: (term(), list()) -> 44 | {ok, pid()} | {ok, pid(), term()} | {error, term()}). 45 | start(_Type, StartArgs) -> 46 | ewts_sup:start_link(StartArgs). 47 | 48 | %%-------------------------------------------------------------------- 49 | %% Function: stop(State) -> void() 50 | %% Description: This function is called whenever an application 51 | %% has stopped. It is intended to be the opposite of Module:start/2 and 52 | %% should do any necessary cleaning up. The return value is ignored. 53 | %%-------------------------------------------------------------------- 54 | -spec(stop/1 :: (term()) -> ok). 55 | stop(_State) -> 56 | ok. 57 | 58 | %%==================================================================== 59 | %% Internal functions 60 | %%==================================================================== 61 | -------------------------------------------------------------------------------- /lib/ewts-1.0/src/ewts_sup.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : ewts_sup.erl 18 | %%% Author : Michal Ptaszek 19 | %%% Description : Main supervisor of Erlang Web Testing Suite 20 | %%% 21 | %%% Created : 16 Jun 2009 by michalptaszek 22 | %%%------------------------------------------------------------------- 23 | -module(ewts_sup). 24 | 25 | -behaviour(supervisor). 26 | 27 | %% API 28 | -export([start_link/1]). 29 | 30 | %% Supervisor callbacks 31 | -export([init/1]). 32 | 33 | -define(SERVER, ?MODULE). 34 | 35 | %%==================================================================== 36 | %% API functions 37 | %%==================================================================== 38 | %%-------------------------------------------------------------------- 39 | %% Function: start_link() -> {ok,Pid} | ignore | {error,Error} 40 | %% Description: Starts the supervisor 41 | %%-------------------------------------------------------------------- 42 | -spec(start_link/1 :: (list()) -> {ok, pid()} | ignore | {error, term()}). 43 | start_link(StartArgs) -> 44 | supervisor:start_link({local, ?SERVER}, ?MODULE, StartArgs). 45 | 46 | %%==================================================================== 47 | %% Supervisor callbacks 48 | %%==================================================================== 49 | %%-------------------------------------------------------------------- 50 | %% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} | 51 | %% ignore | 52 | %% {error, Reason} 53 | %% Description: Whenever a supervisor is started using 54 | %% supervisor:start_link/[2,3], this function is called by the new process 55 | %% to find out about restart strategy, maximum restart frequency and child 56 | %% specifications. 57 | %%-------------------------------------------------------------------- 58 | -spec(init/1 :: (list()) -> {ok, {tuple(), list()}}). 59 | init(_) -> 60 | Client = {client, {ewts_client, start_link, []}, 61 | permanent, 2000, worker, dynamic}, 62 | Dbg = {dbg_tester, {ewts_dbg, start_link, []}, 63 | permanent, 2000, worker, dynamic}, 64 | 65 | {ok,{{one_for_one,2,5000}, [Client, Dbg]}}. 66 | 67 | %%==================================================================== 68 | %% Internal functions 69 | %%==================================================================== 70 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/doc/overview.edoc: -------------------------------------------------------------------------------- 1 | 2 | Some fancy title 3 | 4 | @author Jon Doe [http://www.erlang-consulting.com] 5 | @copyright 2006 Erlang Training & Consulting Ltd. 6 | @version 0.0.1 7 | 8 | @doc 9 | Implementation of some fancy stuff 10 | 11 | 12 | Please send patches to support@erlang-consulting.com 13 | 14 | Bugs reports bugs@erlang-consulting.com 15 | 16 | === Limitations === 17 | Dont do nothing right 18 | 19 | === Copyright === 20 | Copyright (c) 2006, Erlang Training & Consulting Ltd. 21 | 22 | All rights reserved. 23 | 24 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 25 | 26 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 27 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 28 | Neither the name of the Erlang Training & Consulting Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | @end 31 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/ebin/wpart.app: -------------------------------------------------------------------------------- 1 | {application, wpart, [ 2 | {description, "Wpart"}, 3 | {vsn, "1.4.1"}, 4 | {modules, [wpart_app,wpart_db,wpart,wpartlib,wpart_gen, 5 | wpart_master,wpart_valid,wpart_xs,wtpl,wtype,utf8, 6 | utf8_api,wpart_time_str,wpart_utils,validate_tool,wpart_cache, erlydtl_expander]}, 7 | {applications, [kernel, stdlib, sasl, eptic]}, 8 | {env,[]}, 9 | {registered, []}, 10 | {mod, {wpart_app, []}}]}. 11 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/Emakefile: -------------------------------------------------------------------------------- 1 | {'*', [{outdir, "../ebin"}, {i, "../include"}, debug_info, strict_record_tests, netload]}. 2 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/erlydtl_expander.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : erlydtl_expander.erl 18 | %%% @author 19 | %%% @doc ErlyDTL expander file 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(erlydtl_expander). 23 | -export([process_xml/1]). 24 | 25 | process_xml(Mod) -> 26 | case e_dict:get_state() of 27 | {ok, Dict} -> 28 | case Mod:render(Dict) of 29 | {ok, Html} -> 30 | [ 31 | "\n", 32 | wpart_xs:doctype(), 33 | "\n", 34 | Html, 35 | "\n" 36 | ] 37 | end; 38 | _ -> 39 | exit(no_dict_attached) 40 | end. 41 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/utf8.erl: -------------------------------------------------------------------------------- 1 | %% taken from: http://user.it.uu.se/~pergu/utf8.erl 2 | %% written by Per Gustafsson http://user.it.uu.se/~pergu 3 | -module(utf8). 4 | -export([from_binary/1, to_binary/1]). 5 | 6 | %% Given a binary of UTF-8 encoded text, return a UTF-32 String 7 | %% (i.e. each element is a unicode code point). 8 | from_binary(Bin) -> 9 | decode_binary(Bin, []). 10 | 11 | decode_binary(<<>>, Str) -> 12 | {ok, lists:reverse(Str)}; 13 | %% 0-7F 0zzzzzzz 14 | decode_binary(<<2#0:1,CodePoint:7,Rest/binary>>, Str) -> 15 | decode_binary(Rest, [CodePoint|Str]); 16 | %% 110yyyyy 10zzzzzz 17 | decode_binary(<<2#110:3,Y:5,2#10:2,Z:6,Rest/binary>>, Str) -> 18 | <> = <<0:5,Y:5,Z:6>>, 19 | decode_binary(Rest, [CodePoint|Str]); 20 | %% 1110xxxx 10yyyyyy 10zzzzzz 21 | decode_binary(<<2#1110:4,X:4,2#10:2,Y:6,2#10:2,Z:6,Rest/binary>>, Str) -> 22 | <> = <>, 23 | decode_binary(Rest, [CodePoint|Str]); 24 | %% 11110www 10xxxxxx 10yyyyyy 10zzzzzz 25 | decode_binary(<<2#11110:5,W:3,2#10:2,X:6, 26 | 2#10:2,Y:6,2#10:2,Z:6,Rest/binary>>, Str) -> 27 | <> = <<0:3,W:3,X:6,Y:6,Z:6>>, 28 | decode_binary(Rest, [CodePoint|Str]). 29 | 30 | %% Given a list of unicode code points, return a binary of UTF-8 31 | %% encoded text. 32 | to_binary(Str) -> 33 | encode_utf32(Str, []). 34 | 35 | encode_utf32([], Utf8) -> 36 | {ok, list_to_binary(lists:reverse(Utf8))}; 37 | %% 0-7F 0zzzzzzz -> 0zzzzzzz 38 | encode_utf32([U32|Str], Utf8) when U32 < 16#80 -> 39 | encode_utf32(Str, [U32|Utf8]); 40 | %% 80-7FF yyy yyzzzzzz -> 110yyyyy 10zzzzzz 41 | encode_utf32([U32|Str], Utf8) when U32 < 16#800 -> 42 | <<_:5,Y:5,Z:6>> = <>, 43 | encode_utf32(Str, [<<2#110:3,Y:5,2#10:2,Z:6>>|Utf8]); 44 | %% 800-FFFF xxxxyyyy yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz 45 | encode_utf32([U32|Str], Utf8) when U32 < 16#10000 -> 46 | <> = <>, 47 | encode_utf32(Str, [<<2#1110:4,X:4,2#10:2,Y:6,2#10:2,Z:6>>|Utf8]); 48 | %% 10000-10FFFF wwwxx xxxxyyyy yyzzzzzz -> 11110www 10xxxxxx 10yyyyyy 10zzzzzz 49 | encode_utf32([U32|Str], Utf8) when U32 < 16#110000 -> 50 | <<0:3,W:3,X:6,Y:6,Z:6>> = <>, 51 | encode_utf32(Str, [<<2#11110:5,W:3,2#10:2,X:6, 52 | 2#10:2,Y:6,2#10:2,Z:6>>|Utf8]). 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/utf8_api.erl: -------------------------------------------------------------------------------- 1 | %% taken from: http://user.it.uu.se/~pergu/utf8.erl 2 | %% written by Per Gustafsson http://user.it.uu.se/~pergu 3 | 4 | -module(utf8_api). 5 | -export([ulength/1, ustring/1]). 6 | 7 | %% @doc takes regular string encoded in utf. 8 | ulength(String) -> 9 | {Res, List} = utf8:from_binary(list_to_binary(String)), 10 | if 11 | Res == ok -> length(List); 12 | true -> Res 13 | end. 14 | 15 | ustring(RawString) -> 16 | case (catch utf8:from_binary(list_to_binary(RawString))) of 17 | {ok, String} -> 18 | String; 19 | _ -> 20 | RawString 21 | end. 22 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/wpart_app.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : wpart_app.erl 18 | %%% @author Michal Ptaszek 19 | %%% @doc Application and supervisor callback module for wpart application. 20 | %%% The wpart application loads all the tpls and starts the wpart 21 | %%% supervisor.
22 | %%% If any of the possible ecomponents needs the supervisor, it should 23 | %%% attach its process to the wpart supervisor (it is registered locally 24 | %%% under the wpart name). 25 | %%% @end 26 | %%%------------------------------------------------------------------- 27 | 28 | -module(wpart_app). 29 | -export([start/2, stop/1]). 30 | -export([init/1]). 31 | 32 | -define(SUPERVISOR_NAME, wpart). 33 | 34 | -behaviour(application). 35 | -behaviour(supervisor). 36 | 37 | %% @hidden 38 | start(_, _) -> 39 | ets_tables_install(), 40 | 41 | supervisor:start_link({local, ?SUPERVISOR_NAME}, ?MODULE, []). 42 | 43 | %% @hidden 44 | stop(_) -> 45 | ok. 46 | 47 | %% @hidden 48 | init([]) -> 49 | {ok, {{one_for_one, 1, 10}, []}}. 50 | 51 | %%==================================================================== 52 | %% Internal functions 53 | %%==================================================================== 54 | 55 | -spec(ets_tables_install/0 :: () -> ok). 56 | ets_tables_install() -> 57 | {ok, [TypesT]} = file:consult(filename:join([code:priv_dir(wparts),"basic_types.conf"])), 58 | Types = tuple_to_list(TypesT) ++ e_conf:primitive_types(), 59 | ets:insert(e_conf, {primitive_types, Types}), 60 | 61 | catch ets:delete(templates), 62 | ets:new(templates, [named_table, public]), 63 | 64 | Additional = [form, derived, input], 65 | lists:foreach(fun(Type) -> 66 | Mod = list_to_atom("wpart_" ++ atom_to_list(Type)), 67 | Mod:load_tpl() end, 68 | Types ++ Additional). 69 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/wpart_cache.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : wpart_cache.erl 18 | %%% @author Michal Ptaszek 19 | %%% @doc Cache HTML parts expanding module. 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(wpart_cache). 23 | 24 | -export([process_xml/1]). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | -define(DEFAULT_TIMEOUT, 100000). 29 | 30 | process_xml(E) -> 31 | case application:get_env(eptic, node_type) of 32 | {ok, CacheableNode} when CacheableNode == frontend; 33 | CacheableNode == single_node_with_cache -> 34 | cached_content(E); 35 | _ -> 36 | wpart_xs:process_xml(E#xmlElement.content) 37 | end. 38 | 39 | cached_content(E) -> 40 | Id = wpartlib:has_attribute("attribute::id", E), 41 | Groups = prepare_groups(wpartlib:has_attribute("attribute::groups", E)), 42 | Type = get_type(wpartlib:has_attribute("attribute::type", E)), 43 | 44 | if 45 | Id == false; 46 | Groups == false -> 47 | error_logger:warning_msg("~p module, the wpart:cache tag does not have at least one" 48 | " of the mandatory attributes: id or groups~n", 49 | [?MODULE]), 50 | 51 | wpart_xs:process_xml(E#xmlElement.content); 52 | true -> 53 | BId = list_to_binary(Id), 54 | case e_fe_cache:check_cache(BId) of 55 | not_found -> 56 | Result = wpart_xs:process_xml(E#xmlElement.content), 57 | e_fe_cache:save_cache(Type, Groups, BId, term_to_binary(Result)), 58 | Result; 59 | {cached, Cache} -> 60 | Cache 61 | end 62 | end. 63 | 64 | prepare_groups(Groups) -> 65 | lists:map(fun string:strip/1, string:tokens(Groups, [$,])). 66 | 67 | get_type("persistent") -> 68 | persistent; 69 | get_type("timeout(" ++ Rest) -> 70 | case catch list_to_integer(lists:reverse(tl(lists:reverse(Rest)))) of 71 | {'EXIT', _} -> 72 | normal; 73 | T -> 74 | {timeout, T} 75 | end; 76 | get_type("timeout") -> 77 | {timeout, ?DEFAULT_TIMEOUT}; 78 | get_type(_) -> 79 | normal. 80 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/wpart_db.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% File : wpart_db.erl 18 | %%% @author Michal Ptaszek 19 | %%% @end 20 | %%% 21 | %%%------------------------------------------------------------------- 22 | -module(wpart_db). 23 | -export([build_record_structure/2,build_record_structure/3]). 24 | 25 | -include_lib("stdlib/include/qlc.hrl"). 26 | 27 | -deprecated([build_record_structure/3]). 28 | 29 | -spec(build_record_structure/2 :: (atom(), tuple()) -> list({string(), term()})). 30 | build_record_structure(TypeName, TypeValues) -> 31 | build_record_structure0(TypeName, TypeValues, atom_to_list(TypeName) ++ "_"). 32 | 33 | -spec(build_record_structure/3 :: (atom(), term(), tuple()) -> list({string(), term()})). 34 | build_record_structure(TypeName, _, TypeValues) -> 35 | build_record_structure0(TypeName, TypeValues, atom_to_list(TypeName) ++ "_"). 36 | 37 | -spec(build_record_structure0/3 :: (atom(), tuple(), string()) -> list({string(), term()})). 38 | build_record_structure0(TypeName, TypeValues0, Prefix) -> 39 | NameString = atom_to_list(TypeName), 40 | TypeDefs0 = (list_to_atom("wtype_" ++ NameString)):get_record_info( 41 | list_to_atom(NameString ++ "_types")), 42 | TypeDefs = tl(tuple_to_list(TypeDefs0)), 43 | TypeNames = (list_to_atom("wtype_" ++ NameString)):get_record_info(TypeName), 44 | TypeValues = tl(tuple_to_list(TypeValues0)), 45 | 46 | Primitives = e_conf:primitive_types(), 47 | 48 | lists:flatten(lists:foldl(fun({Val, {Name, {Type, _}}}, Acc) -> 49 | case lists:member(Type, Primitives) of 50 | true -> 51 | [{Prefix ++ atom_to_list(Name), Val} | Acc]; 52 | false -> 53 | [build_record_structure(Type, Val, 54 | Prefix ++ atom_to_list(Name) ++ "_") | 55 | Acc] 56 | end 57 | end, 58 | [], lists:zip(TypeValues, lists:zip(TypeNames, TypeDefs)))). 59 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/src/wpart_master.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Martin Carlson 18 | %%% @doc 19 | %%% 20 | %%% @end 21 | %%% @hidden 22 | %%%------------------------------------------------------------------- 23 | -module(wpart_master). 24 | 25 | %% API 26 | -export([handle_call/1]). 27 | -include_lib("xmerl/include/xmerl.hrl"). 28 | 29 | %%==================================================================== 30 | %% API 31 | %%==================================================================== 32 | handle_call(E) -> 33 | View = eptic:fget("wpart_xs_view"), 34 | case wpartlib:has_attribute("attribute::selection", E) of 35 | false -> 36 | erlang:error({badarg, missing_selection}); 37 | "head" -> 38 | xmerl_xs:select("/html/head/*", View); 39 | "body" -> 40 | xmerl_xs:select("/html/body/*", View); 41 | Path -> 42 | xmerl_xs:select(Path, View) 43 | end. 44 | 45 | %%==================================================================== 46 | %% Internal functions 47 | %%==================================================================== 48 | -------------------------------------------------------------------------------- /lib/wpart-1.4.1/tests/Emakefile: -------------------------------------------------------------------------------- 1 | {'*', [{outdir, "../ebin"}, {i, "../include"}, debug_info, strict_record_tests, netload]}. 2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/doc/overview.edoc: -------------------------------------------------------------------------------- 1 | 2 | Some fancy title 3 | 4 | @author Jon Doe [http://www.erlang-consulting.com] 5 | @author Martin Carlson [http://www.erlang-consulting.com] 6 | @copyright 2006 Erlang Training & Consulting Ltd. 7 | @version 0.0.1 8 | 9 | @doc 10 | Generic wpart and wtype library. 11 | 12 | Please send patches to support@erlang-consulting.com 13 | 14 | Bugs reports bugs@erlang-consulting.com 15 | 16 | === Limitations === 17 | Dont do nothing right 18 | 19 | === Copyright === 20 | Copyright (c) 2006, Erlang Training & Consulting Ltd. 21 | 22 | All rights reserved. 23 | 24 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 25 | 26 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 27 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 28 | Neither the name of the Erlang Training & Consulting Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | @end 31 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/ebin/wparts.app: -------------------------------------------------------------------------------- 1 | {application, wparts, 2 | [{description, "Wpart Components"}, 3 | {vsn, "1.4.1"}, 4 | {modules, [wpart_autocomplete,wpart_bool,wpart_choose,wpart_csv,wpart_date,wpart_datetime,wpart_derived,wpart_enum,wpart_form,wpart_include,wpart_input,wpart_integer,wpart_lang,wpart_list,wpart_lookup,wpart_lookup_unbreak,wpart_multilist,wpart_password,wpart_string,wpart_text,wpart_time,wpart_upload,wtype_autocomplete,wtype_bool,wtype_csv,wtype_date,wtype_datetime,wtype_enum,wtype_html,wtype_integer,wtype_multilist,wtype_password,wtype_string,wtype_term,wtype_text,wtype_time,wtype_upload,wpart_float,wtype_float,wpart_paginate,wtype_atom,wpart_atom,wpart_collection,wtype_collection,wpart_comment]}, 5 | {registered,[]}, 6 | {env,[]}, 7 | {applications, [kernel, stdlib, sasl, eptic, wpart]}]}. 8 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/autocomplete.css: -------------------------------------------------------------------------------- 1 | .ac_results { 2 | border-right: windowframe 1px solid; 3 | padding-right: 0px; 4 | border-top: windowframe 1px solid; 5 | padding-left: 0px; 6 | padding-bottom: 0px; 7 | overflow: hidden; 8 | border-left: windowframe 1px solid; 9 | padding-top: 0px; 10 | border-bottom: windowframe 1px solid; 11 | background-color: window 12 | } 13 | 14 | .ac_results ul { 15 | padding-right: 0px; 16 | padding-left: 0px; 17 | list-style-position: outside; 18 | padding-bottom: 0px; 19 | margin: 0px; 20 | width: 100%; 21 | padding-top: 0px; 22 | list-style-type: none 23 | } 24 | 25 | .ac_results iframe { 26 | display: block; 27 | z-index: -1; 28 | filter: mask(); 29 | left: 0px; 30 | width: 3000px; 31 | position: absolute; 32 | top: 0px; 33 | height: 3000px 34 | } 35 | 36 | .ac_results li { 37 | padding-right: 5px; 38 | display: block; 39 | padding-left: 5px; 40 | font-size: 12px; 41 | padding-bottom: 2px; 42 | margin: 0px; 43 | font: menu; 44 | overflow: hidden; 45 | width: 100%; 46 | cursor: pointer; 47 | padding-top: 2px; 48 | } 49 | 50 | .ac_loading { 51 | background: url(./indicator.gif) window no-repeat right center; 52 | } 53 | 54 | .ac_over { 55 | color: highlighttext; 56 | background-color: highlight 57 | } 58 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/basic_types.conf: -------------------------------------------------------------------------------- 1 | {integer, string, date, bool, enum, text, upload, password, multilist, multiselect, time, datetime, autocomplete, csv, float, atom, collection}. -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/atom.tpl: -------------------------------------------------------------------------------- 1 | value="<% value %>"/>
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/autocomplete.tpl: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/bool.tpl: -------------------------------------------------------------------------------- 1 | /> 2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/collection_element.tpl: -------------------------------------------------------------------------------- 1 |
2 | <% editing_elements %> 3 | 4 |
5 | 15 | 16 | <% input_element %> 17 |
18 | 19 | Add next 20 |
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/csv.tpl: -------------------------------------------------------------------------------- 1 | />
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/date.tpl: -------------------------------------------------------------------------------- 1 | />
2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/datetime.tpl: -------------------------------------------------------------------------------- 1 | />
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/derived.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/div_form.tpl: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/div_item.tpl: -------------------------------------------------------------------------------- 1 |
2 | 6 | <% input %> 7 |
8 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/enum.tpl: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/float.tpl: -------------------------------------------------------------------------------- 1 | />
2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/form.tpl: -------------------------------------------------------------------------------- 1 |
> 2 | 3 | />
4 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/input_id.tpl: -------------------------------------------------------------------------------- 1 | />
2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/integer.tpl: -------------------------------------------------------------------------------- 1 | />
2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/list_form.tpl: -------------------------------------------------------------------------------- 1 |
    2 | 3 |
-------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/list_item.tpl: -------------------------------------------------------------------------------- 1 |
  • 2 | 6 | <% input %> 7 |
  • 8 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/multiselect.tpl: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/option.tpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/paragraph_form.tpl: -------------------------------------------------------------------------------- 1 |

    2 | 3 |

    -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/paragraph_item.tpl: -------------------------------------------------------------------------------- 1 |

    2 | 6 | <% input %> 7 |

    -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/password.tpl: -------------------------------------------------------------------------------- 1 | />
    2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/select.tpl: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/span.tpl: -------------------------------------------------------------------------------- 1 | > <% content %> -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/string.tpl: -------------------------------------------------------------------------------- 1 | />
    2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/table_form.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/table_item.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <% input %> 7 | 8 | 9 | 10 | 11 | <% comment %> 12 | <% error %> 13 | 14 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/text.tpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/time.tpl: -------------------------------------------------------------------------------- 1 | />
    -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/upload.tpl: -------------------------------------------------------------------------------- 1 | /><% comment %> -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/html/upload_edit.tpl: -------------------------------------------------------------------------------- 1 |
    Current file: <% path %>
    2 | Leave it blank if you don't want a change
    -------------------------------------------------------------------------------- /lib/wparts-1.4.1/priv/indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/wparts-1.4.1/priv/indicator.gif -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_atom.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_atom). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 39 | 40 | get_html_tag(Attrs, Default). 41 | 42 | build_html_tag(Name, Prefix, Params, Default) -> 43 | Description = wpart_derived:get_description(Name, Params), 44 | N = wpart_derived:generate_long_name(Prefix, Name), 45 | D = wpart_derived:find(N, Default), 46 | 47 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 48 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 49 | 50 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 51 | 52 | get_html_tag(Attrs, Default) when is_atom(Default) -> 53 | get_html_tag(Attrs, atom_to_list(Default)); 54 | get_html_tag(Attrs, Default) -> 55 | wpart_gen:build_html(wpart_gen:tpl_get(atom), 56 | [{"html", wpart:proplist2html(Attrs)}, 57 | {"value", Default}]). 58 | 59 | load_tpl() -> 60 | wpart_gen:load_tpl(atom, 61 | filename:join([code:priv_dir(wparts),"html","atom.tpl"])). 62 | 63 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_autocomplete.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Zajda 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_autocomplete). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/3]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs1 = wpart:xml2proplist(Attrs0), 32 | Attrs = [{"complete", string:tokens(proplists:get_value(complete, Attrs1, ""), [$|])} | 33 | proplists:delete("complete", Attrs1)], 34 | 35 | #xmlText{value = get_html_tag(Attrs, wpart:getValue(Attrs)), 36 | type = cdata}. 37 | 38 | build_html_tag(Id, Params, Default) -> 39 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 40 | Attrs = [{"name", Id}, {"id", Id}, 41 | {"complete", proplists:get_value(complete, Params, [])} 42 | | proplists:delete("complete", proplists:delete("name", Attrs0))], 43 | 44 | get_html_tag(Attrs, Default). 45 | 46 | build_html_tag(Name, Prefix, Params, Default) -> 47 | N = wpart_derived:generate_long_name(Prefix, Name), 48 | Description = wpart_derived:get_description(Name, Params), 49 | D = wpart_derived:find(N, Default), 50 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 51 | Attrs = [{"name", N}, {"complete", proplists:get_value(complete, Params, [])} | 52 | proplists:delete("name", Attrs0)], 53 | 54 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 55 | 56 | get_html_tag(Attrs, Default) -> 57 | Complete = case proplists:get_value("complete", Attrs) of 58 | [] -> 59 | ""; 60 | Strings -> 61 | tl(lists:foldl(fun(X, Acc) -> 62 | Acc ++ ",'" ++ X ++ "'" 63 | end, "", Strings)) 64 | end, 65 | wpart_gen:build_html(wpart_gen:tpl_get(autocomplete), 66 | [{"complete", Complete}, 67 | {"name", proplists:get_value("name", Attrs, "")}]) ++ 68 | wpart_gen:build_html(wpart_gen:tpl_get(autocomplete_input_id), 69 | [{"html", wpart:proplist2html(proplists:delete("complete", Attrs))}, 70 | {"value", Default}]). 71 | 72 | load_tpl() -> 73 | wpart_gen:load_tpl(autocomplete, 74 | filename:join([code:priv_dir(wparts),"html","autocomplete.tpl"])), 75 | wpart_gen:load_tpl(autocomplete_input_id, 76 | filename:join([code:priv_dir(wparts),"html","input_id.tpl"])). 77 | 78 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_bool.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_bool). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, ""), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 39 | get_html_tag(Attrs, Default). 40 | 41 | build_html_tag(Name, Prefix, Params, Default) -> 42 | N = wpart_derived:generate_long_name(Prefix, Name), 43 | Description = wpart_derived:get_description(Name, Params), 44 | D = wpart_derived:find(N, Default), 45 | 46 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_tags, Params, [])), 47 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 48 | 49 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 50 | 51 | get_html_tag(Attrs0, Default) -> 52 | Attrs = if 53 | Default == true -> 54 | [{"checked", "checked"} | Attrs0]; 55 | true -> 56 | Attrs0 57 | end, 58 | 59 | wpart_gen:build_html(wpart_gen:tpl_get(bool), 60 | [{"html", 61 | wpart:proplist2html([{"value", proplists:get_value("name", Attrs, "")} | Attrs])} 62 | ]). 63 | 64 | load_tpl() -> 65 | wpart_gen:load_tpl(bool, 66 | filename:join([code:priv_dir(wparts),"html","bool.tpl"])). 67 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_collection.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @version 1.0 18 | %%% @author Michal Ptaszek 19 | %%% @doc 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(wpart_collection). 23 | %-behaviour(wpart). 24 | 25 | -export([handle_call/1, build_html_tag/4, load_tpl/0]). 26 | 27 | -include_lib("xmerl/include/xmerl.hrl"). 28 | 29 | handle_call(E) -> 30 | Name = case wpartlib:has_attribute("attribute::name", E) of 31 | false -> "no_name_collection"; 32 | Val -> Val 33 | end, 34 | Type = wpartlib:has_attribute("attribute::type", E), 35 | Extra = case wpartlib:has_attribute("attribute::extra", E) of 36 | false -> ""; 37 | Ex -> Ex 38 | end, 39 | 40 | #xmlText{value=get_html_tag(Name, [], Type, Extra), 41 | type=cdata}. 42 | 43 | %% @todo add extra params? 44 | build_html_tag(Name, Prefix, Params, Default) -> 45 | Description = wpart_derived:get_description(Name, Params), 46 | N = wpart_derived:generate_long_name(Prefix, Name), 47 | D = wpart_derived:find(N, Default), 48 | Type = atom_to_list(element(1, proplists:get_value(type, Params))), 49 | 50 | wpart_derived:surround_with_table(N, get_html_tag(N, D, Type, ""), Description). 51 | 52 | %% @todo handle default 53 | get_html_tag(Name, Default, Type, Extra) -> 54 | TypeMod = list_to_atom("wpart_" ++ Type), 55 | Elements = lists:foldl(fun({ElementName, _} = Def, Acc) -> 56 | Row0 = TypeMod:build_html_tag(list_to_atom(ElementName), "", [{description , ""}], [Def]), 57 | Row = get_content(Row0), 58 | 59 | [Row | Acc] 60 | end, [], Default), 61 | Counter = integer_to_list(length(Default)+1), 62 | 63 | InputElement0 = TypeMod:build_html_tag(list_to_atom(Name ++ "_" ++ Counter), "", [{description, ""}], []), 64 | InputElement = get_content(InputElement0), 65 | 66 | HTML = wpart_gen:build_html(wpart_gen:tpl_get(collection), [{"name", Name}, 67 | {"extra", Extra}, 68 | {"type", Type}, 69 | {"input_element", InputElement}, 70 | {"editing_elements", lists:flatten(Elements)}, 71 | {"counter_start", Counter}]), 72 | 73 | {XML, _} = xmerl_scan:string(HTML), 74 | re:replace(lists:flatten(wpart_xs:template(XML)), "\n", "", [global, dotall, {return, list}]). 75 | 76 | get_content(String) -> 77 | {XML, _} = xmerl_scan:string(String), 78 | Input = xmerl_xpath:string("td[2]//node()", XML), 79 | 80 | lists:flatten(wpart_xs:template(Input)). 81 | 82 | load_tpl() -> 83 | wpart_gen:load_tpl(collection, 84 | filename:join([code:priv_dir(wparts),"html","collection_element.tpl"])). 85 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_comment.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc Wpart responsible for skipping the content between the tags 19 | %%% (developer comments - they will not appear on the browser side). 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(wpart_comment). 23 | 24 | -export([handle_call/1]). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | handle_call(_) -> 29 | #xmlText{value = ""}. 30 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_date.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_date). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Format = proplists:get_value(format, Params, "YYYY-MM-DD"), 39 | Attrs = [{"name", Id}, {"id", Id}, {"format", Format} | 40 | proplists:delete("name", Attrs0)], 41 | 42 | get_html_tag(Attrs, Default). 43 | 44 | build_html_tag(Name, Prefix, Params, Default) -> 45 | Description = wpart_derived:get_description(Name, Params), 46 | N = wpart_derived:generate_long_name(Prefix, Name), 47 | D = wpart_derived:find(N, Default), 48 | 49 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 50 | Format = proplists:get_value(format, Params, "YYYY-MM-DD"), 51 | Attrs = [{"name", N}, {"format", Format} | proplists:delete("name", Attrs0)], 52 | 53 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 54 | 55 | get_html_tag(Attrs, Default) -> 56 | Date = if 57 | Default == "" -> 58 | ""; 59 | true -> 60 | Format = proplists:get_value("format", Attrs, "YYYY-MM-DD"), 61 | wtype_date:get_date(Format, Default) 62 | end, 63 | 64 | wpart_gen:build_html(wpart_gen:tpl_get(date), 65 | [{"html", wpart:proplist2html(proplists:delete("format", Attrs))}, 66 | {"value", Date}]). 67 | 68 | load_tpl() -> 69 | wpart_gen:load_tpl(date, 70 | filename:join([code:priv_dir(wparts),"html","date.tpl"])). 71 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_datetime.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @version $Rev$ 18 | %%% @author Michal Zajda 19 | %%% @doc 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | -module(wpart_datetime). 23 | -behaviour(wpart). 24 | 25 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 26 | 27 | -deprecated([build_html_tag/4]). 28 | 29 | -include_lib("xmerl/include/xmerl.hrl"). 30 | 31 | handle_call(#xmlElement{attributes = Attrs0}) -> 32 | Attrs = wpart:xml2proplist(Attrs0), 33 | 34 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 35 | type=cdata}. 36 | 37 | build_html_tag(Id, Params, Default) -> 38 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 39 | Format = proplists:get_value(format, Params, "YYYY-MM-DD HH:NN:SS"), 40 | Attrs = [{"name", Id}, {"id", Id}, {"format", Format} | 41 | proplists:delete("name", Attrs0)], 42 | 43 | get_html_tag(Attrs, Default). 44 | 45 | build_html_tag(Name, Prefix, Params, Default) -> 46 | Description = wpart_derived:get_description(Name, Params), 47 | N = wpart_derived:generate_long_name(Prefix, Name), 48 | D = wpart_derived:find(N, Default), 49 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 50 | Format = proplists:get_value(format, Params, "YYYY-MM-DD HH:NN:SS"), 51 | Attrs = [{"name", N}, {"format", Format} | proplists:delete("name", Attrs0)], 52 | 53 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 54 | 55 | get_html_tag(Attrs, Default) -> 56 | DateTime = if 57 | Default == "" -> 58 | ""; 59 | true -> 60 | Format = proplists:get_value("format", Attrs, "YYYY-MM-DD HH:NN:SS"), 61 | wtype_datetime:format(Format, Default) 62 | end, 63 | 64 | wpart_gen:build_html(wpart_gen:tpl_get(datetime), 65 | [{"html", wpart:proplist2html( 66 | proplists:delete("format", Attrs))}, 67 | {"value", DateTime}]). 68 | 69 | load_tpl() -> 70 | wpart_gen:load_tpl(datetime, 71 | filename:join([code:priv_dir(wparts),"html","datetime.tpl"])). 72 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_float.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_float). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs), undefined), 33 | type=cdata}. 34 | 35 | build_html_tag(Id, Params, Default) -> 36 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 37 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 38 | Precision = proplists:get_value(precision, Params), 39 | get_html_tag(Attrs, Default, Precision). 40 | 41 | build_html_tag(Name, Prefix, Params, Default) -> 42 | Description = wpart_derived:get_description(Name, Params), 43 | N = wpart_derived:generate_long_name(Prefix, Name), 44 | D = wpart_derived:find(N, Default), 45 | Precision = proplists:get_value(precision, Params), 46 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 47 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 48 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D, Precision), Description). 49 | 50 | get_html_tag(Attrs, Default, Precision) when is_float(Default) -> 51 | case Precision of 52 | undefined -> 53 | Value = float_to_list(Default); 54 | N when is_integer(N) -> 55 | Value = lists:flatten(io_lib:format("~.*..f", [N, Default])) 56 | end, 57 | get_html_tag(Attrs, Value, none); 58 | get_html_tag(Attrs, Default, _Precision) -> 59 | wpart_gen:build_html(wpart_gen:tpl_get(float), 60 | [{"html", wpart:proplist2html([{"value", Default} | Attrs])}]). 61 | 62 | load_tpl() -> 63 | wpart_gen:load_tpl(float, 64 | filename:join([code:priv_dir(wparts),"html","float.tpl"])). 65 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_form.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_form). 22 | -export([handle_call/1, load_tpl/0]). 23 | 24 | -include_lib("xmerl/include/xmerl.hrl"). 25 | 26 | handle_call(E) -> 27 | Value = case wpartlib:has_attribute("attribute::submit_text", E) of 28 | false -> 29 | ""; 30 | Text -> 31 | "value='" ++ Text ++ "' " 32 | end, 33 | 34 | case wpartlib:has_attribute("attribute::type", E) of 35 | false -> []; 36 | Type -> 37 | case wpartlib:has_attribute("attribute::action", E) of 38 | false -> 39 | []; 40 | Action -> 41 | FormType = wpart:has_attribute("attribute::form_type", "div", E), 42 | 43 | {XML, _} = xmerl_scan:string(build_form(FormType, Type, Action, Value)), 44 | Template = wpart_xs:template(XML), 45 | 46 | #xmlText{value=Template, 47 | type=cdata} 48 | end 49 | end. 50 | 51 | build_form(FormType, Name, Action, Value) -> 52 | Multi = check_for_multipart(Name, e_conf:primitive_types()), 53 | 54 | Multipart = if 55 | Multi == true -> "enctype=\"multipart/form-data\""; 56 | true -> "" 57 | end, 58 | 59 | wpart_gen:build_html(wpart_gen:tpl_get(form), [{"action", Action}, 60 | {"multipart", Multipart}, 61 | {"type", Name}, 62 | {"submit", Value}, 63 | {"form_type", FormType}]). 64 | 65 | check_for_multipart(Name, BasicTypes) -> 66 | Module = list_to_atom("wtype_" ++ Name), 67 | [_ | Types] = tuple_to_list(apply(Module, get_record_info, 68 | [list_to_atom(Name ++ "_types")])), 69 | 70 | Checker = fun(X) -> 71 | [Type | _] = tuple_to_list(X), 72 | case lists:member(Type, BasicTypes) of 73 | true -> 74 | if 75 | Type == upload -> true; 76 | true -> false 77 | end; 78 | false -> 79 | check_for_multipart(atom_to_list(Type), 80 | BasicTypes) 81 | end 82 | end, 83 | 84 | lists:any(Checker, Types). 85 | 86 | load_tpl() -> 87 | wpart_gen:load_tpl(form, 88 | filename:join([code:priv_dir(wparts), "html", "form.tpl"])). 89 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_include.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | 22 | -module(wpart_include). 23 | 24 | -export([handle_call/1]). 25 | -include_lib("xmerl/include/xmerl.hrl"). 26 | 27 | handle_call(E) -> 28 | File = wpart:has_attribute("attribute::file", E), 29 | As = wpart:has_attribute("attribute::as", E), 30 | Format = wpart:has_attribute("attribute::format", E), 31 | Type = wpart:has_attribute("attribute::type", E), 32 | 33 | {ok, Bin} = file:read_file(sanitise_filename(File)), 34 | Tpl = binary_to_list(Bin), 35 | if 36 | As == false, Format == false -> 37 | if 38 | Type == "cdata" -> 39 | #xmlText{value = Tpl, type=cdata}; 40 | true -> 41 | #xmlText{value = Tpl} 42 | end; 43 | As == false -> 44 | Val = wpartlib:format(Tpl, E), 45 | if 46 | Type == "cdata" -> 47 | #xmlText{value = Val, type=cdata}; 48 | true -> 49 | #xmlText{value = Val} 50 | end; 51 | Format == false -> 52 | wpart:fset(As, Tpl); 53 | true -> 54 | wpart:fset(As, wpartlib:format(Tpl, E)) 55 | end. 56 | 57 | sanitise_filename([$/|T]) -> 58 | sanitise_filename0(T); 59 | sanitise_filename(T) -> 60 | sanitise_filename0(T). 61 | 62 | sanitise_filename0([$.,$.,$/|T]) -> 63 | sanitise_filename0(T); 64 | sanitise_filename0([$.,$.|T]) -> 65 | sanitise_filename0(T); 66 | sanitise_filename0([H|T]) -> 67 | [H|sanitise_filename0(T)]; 68 | sanitise_filename0([]) -> 69 | []. 70 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_input.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | 22 | -module(wpart_input). 23 | -export([handle_call/1, load_tpl/0]). 24 | 25 | -include_lib("xmerl/include/xmerl.hrl"). 26 | 27 | -spec(handle_call/1 :: (tuple()) -> tuple()). 28 | handle_call(#xmlElement{attributes = Attrs0} = E) -> 29 | case wpartlib:has_attribute("attribute::type", E) of 30 | false -> 31 | []; 32 | Type -> 33 | FormType = case wpartlib:has_attribute("attribute::form_type", E) of 34 | false -> 35 | undefined; 36 | Else -> 37 | list_to_atom(Else) 38 | end, 39 | Attrs = wpart:xml2proplist(Attrs0), 40 | 41 | {XML, _} = xmerl_scan:string(build_tag(FormType, Type, Attrs)), 42 | Template = wpart_xs:template(XML), 43 | 44 | #xmlText{value=Template, 45 | type=cdata} 46 | end. 47 | 48 | -spec(build_tag/3 :: (atom(), string(), list()) -> string()). 49 | build_tag(FormType, Type, Attrs) -> 50 | Parts = wpart_gen:tpl_get(wpart, form_type(FormType)), 51 | wpart_gen:build_html(Parts, [{"id", Type}, 52 | {"form_type", atom_to_list(FormType)}, 53 | {"type", Type}, 54 | {"html", wpart:proplist2html(proplists:delete("type", Attrs))}]). 55 | 56 | -spec(form_type/1 :: (atom()) -> atom()). 57 | form_type(table) -> 58 | table_form; 59 | form_type(list) -> 60 | list_form; 61 | form_type(paragraph) -> 62 | paragraph_form; 63 | form_type(_) -> 64 | div_form. 65 | 66 | -spec(load_tpl/0 :: () -> true). 67 | load_tpl() -> 68 | wpart_gen:load_tpl(table_form, 69 | filename:join([code:priv_dir(wparts),"html","table_form.tpl"])), 70 | 71 | wpart_gen:load_tpl(paragraph_form, 72 | filename:join([code:priv_dir(wparts),"html","paragraph_form.tpl"])), 73 | 74 | wpart_gen:load_tpl(list_form, 75 | filename:join([code:priv_dir(wparts),"html","list_form.tpl"])), 76 | 77 | wpart_gen:load_tpl(div_form, 78 | filename:join([code:priv_dir(wparts),"html","div_form.tpl"])). 79 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_integer.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_integer). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 39 | 40 | get_html_tag(Attrs, Default). 41 | 42 | build_html_tag(Name, Prefix, Params, Default) -> 43 | Description = wpart_derived:get_description(Name, Params), 44 | N = wpart_derived:generate_long_name(Prefix, Name), 45 | D = wpart_derived:find(N, Default), 46 | 47 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 48 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 49 | 50 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 51 | 52 | get_html_tag(Attrs, Default) when is_integer(Default) -> 53 | get_html_tag(Attrs, integer_to_list(Default)); 54 | get_html_tag(Attrs, Default) -> 55 | wpart_gen:build_html(wpart_gen:tpl_get(integer), 56 | [{"html", wpart:proplist2html([{"value", Default} | Attrs])}]). 57 | 58 | load_tpl() -> 59 | wpart_gen:load_tpl(integer, 60 | filename:join([code:priv_dir(wparts),"html","integer.tpl"])). 61 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_lookup.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @copyright (C) 2006, Erlang Training & Consulting, Inc. 18 | %%% @author Martin Carlson 19 | %%% @doc 20 | %%% 21 | %%% @end 22 | %%%------------------------------------------------------------------- 23 | -module(wpart_lookup). 24 | 25 | %% API 26 | -export([handle_call/1]). 27 | -include_lib("xmerl/include/xmerl.hrl"). 28 | 29 | %%============================================================================== 30 | %% API 31 | %%============================================================================== 32 | handle_call(E) -> 33 | case wpartlib:has_attribute("attribute::key", E) of 34 | false -> 35 | []; 36 | Key -> 37 | case wpart:fget(Key) of 38 | undefined -> 39 | []; 40 | Value -> 41 | Type = case wpartlib:has_attribute("attribute::type", E) of 42 | "html" -> 43 | cdata; 44 | "cdata" -> 45 | cdata; 46 | _ -> 47 | text 48 | end, 49 | 50 | #xmlText{value = wpartlib:format(Value, E), 51 | type = Type} 52 | end 53 | end. 54 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_lookup_unbreak.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Solutions Ltd. 13 | %% Portions created by Erlang Solutions Ltd. are Copyright 2008-2010, 14 | %% Erlang Solutions Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @copyright (C) 2010, Erlang Solutions Ltd. 18 | %%% @author Magnus Henoch 19 | %%% @doc Wpart similar to wpart:lookup, except that it 20 | %%% only works for strings, and takes care not to double-encode UTF-8 21 | %%% data. This will eventually be fixed in wpart:lookup... 22 | %%% @end 23 | -module(wpart_lookup_unbreak). 24 | 25 | %% API 26 | -export([handle_call/1]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | %%============================================================================== 31 | %% API 32 | %%============================================================================== 33 | handle_call(#xmlElement{} = E) -> 34 | Key = wpartlib:has_attribute("attribute::key", E), 35 | case wpart:fget(Key) of 36 | undefined -> 37 | ""; 38 | Value -> 39 | #xmlText{type = cdata, 40 | value = wtype_html:htmlize(Value)} 41 | end. 42 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_password.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_password). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, _) -> 37 | Attrs0 = wpart:normalize_html_attrs([{confirm, proplists:get_value(confirm, Params, false)} | 38 | proplists:get_value(html_attrs, Params, [])]), 39 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 40 | 41 | get_html_tag(Attrs). 42 | 43 | build_html_tag(Name, Prefix, Params, _) -> 44 | N = wpart_derived:generate_long_name(Prefix, Name), 45 | Description = wpart_derived:get_description(Name, Params), 46 | Attrs0 = wpart:normalize_html_attrs([{confirm, proplists:get_value(confirm, Params, false)} | 47 | proplists:get_value(html_attrs, Params, [])]), 48 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 49 | 50 | wpart_derived:surround_with_table(N, get_html_tag(Attrs), Description). 51 | 52 | get_html_tag(Attrs) -> 53 | Field = wpart_gen:build_html(wpart_gen:tpl_get(password), 54 | [{"html", wpart:proplist2html(proplists:delete("confirm", Attrs))}]), 55 | 56 | case proplists:get_value("confirm", Attrs, "false") of 57 | "false" -> 58 | Field; 59 | _ -> 60 | Field ++ Field 61 | end. 62 | 63 | load_tpl() -> 64 | wpart_gen:load_tpl(password, 65 | filename:join([code:priv_dir(wparts),"html","password.tpl"])). 66 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_string.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_string). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 33 | type=cdata}. 34 | 35 | build_html_tag(Id, Params, Default) -> 36 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 37 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 38 | 39 | get_html_tag(Attrs, wtype_html:htmlize(Default)). 40 | 41 | build_html_tag(Name, Prefix, Params, Default) -> 42 | Description = wpart_derived:get_description(Name, Params), 43 | N = wpart_derived:generate_long_name(Prefix, Name), 44 | D = wpart_derived:find(N, Default), 45 | 46 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 47 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 48 | 49 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, wtype_html:htmlize(D)), 50 | Description). 51 | 52 | get_html_tag(Attrs, Default) -> 53 | wpart_gen:build_html(wpart_gen:tpl_get(string), 54 | [{"html", wpart:proplist2html(Attrs)}, 55 | {"value", Default}]). 56 | 57 | load_tpl() -> 58 | wpart_gen:load_tpl(string, 59 | filename:join([code:priv_dir(wparts),"html","string.tpl"])). 60 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_text.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_text). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | DefaultText = " ", 38 | D = case Default of 39 | "" -> 40 | DefaultText; 41 | undefined -> 42 | DefaultText; 43 | Else -> 44 | Else 45 | end, 46 | 47 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 48 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 49 | 50 | get_html_tag(Attrs, wtype_html:htmlize(D)). 51 | 52 | build_html_tag(Name, Prefix, Params, Default) -> 53 | N = wpart_derived:generate_long_name(Prefix, Name), 54 | Description = wpart_derived:get_description(Name, Params), 55 | 56 | DefaultText = " ", 57 | D = case lists:keysearch(N, 1, Default) of 58 | {value, {_, ""}} -> 59 | DefaultText; 60 | {value, {_, undefined}} -> 61 | DefaultText; 62 | {value, {_, Val}} -> 63 | Val; 64 | false -> 65 | DefaultText 66 | end, 67 | 68 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 69 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 70 | 71 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, wtype_html:htmlize(D)), 72 | Description). 73 | 74 | get_html_tag(Attrs, Default) -> 75 | wpart_gen:build_html(wpart_gen:tpl_get(text), 76 | [{"html", wpart:proplist2html(Attrs)}, 77 | {"value", Default}]). 78 | 79 | load_tpl() -> 80 | wpart_gen:load_tpl(text, 81 | filename:join([code:priv_dir(wparts),"html","text.tpl"])). 82 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_time.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Zajda 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_time). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, wpart:getValue(Attrs)), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Format = proplists:get_value(format, Params, "HH:MM"), 39 | Attrs = [{"name", Id}, {"format", Format}, {"id", Id} | proplists:delete("name", Attrs0)], 40 | 41 | get_html_tag(Attrs, Default). 42 | 43 | build_html_tag(Name, Prefix, Params, Default) -> 44 | Description = wpart_derived:get_description(Name, Params), 45 | N = wpart_derived:generate_long_name(Prefix, Name), 46 | D = wpart_derived:find(N, Default), 47 | 48 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 49 | Format = proplists:get_value(format, Params, "HH:MM:SS"), 50 | Attrs = [{"name", N}, {"format", Format} | proplists:delete("name", Attrs0)], 51 | 52 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 53 | 54 | get_html_tag(Attrs, Default) when is_tuple(Default) -> 55 | Format = proplists:get_value("format", Attrs, "HH:MM:SS"), 56 | get_html_tag(Attrs, wtype_time:get_time(Format, Default)); 57 | get_html_tag(Attrs, Default) -> 58 | wpart_gen:build_html(wpart_gen:tpl_get(time), 59 | [{"html", wpart:proplist2html(proplists:delete("format", Attrs))}, 60 | {"value", Default}]). 61 | 62 | load_tpl() -> 63 | wpart_gen:load_tpl(time, 64 | filename:join([code:priv_dir(wparts),"html","time.tpl"])). 65 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wpart_upload.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wpart_upload). 22 | -behaviour(wpart). 23 | 24 | -export([handle_call/1, build_html_tag/4, build_html_tag/3, load_tpl/0]). 25 | 26 | -deprecated([build_html_tag/4]). 27 | 28 | -include_lib("xmerl/include/xmerl.hrl"). 29 | 30 | handle_call(#xmlElement{attributes = Attrs0}) -> 31 | Attrs = wpart:xml2proplist(Attrs0), 32 | 33 | #xmlText{value=get_html_tag(Attrs, ""), 34 | type=cdata}. 35 | 36 | build_html_tag(Id, Params, Default) -> 37 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 38 | Attrs = [{"name", Id}, {"id", Id} | proplists:delete("name", Attrs0)], 39 | 40 | get_html_tag(Attrs, Default). 41 | 42 | build_html_tag(Name, Prefix, Params, Default) -> 43 | Description = wpart_derived:get_description(Name, Params), 44 | N = wpart_derived:generate_long_name(Prefix, Name), 45 | D = wpart_derived:find(N, Default), 46 | Attrs0 = wpart:normalize_html_attrs(proplists:get_value(html_attrs, Params, [])), 47 | Attrs = [{"name", N} | proplists:delete("name", Attrs0)], 48 | 49 | wpart_derived:surround_with_table(N, get_html_tag(Attrs, D), Description). 50 | 51 | get_html_tag(Attrs, Default) when Default == undefined; Default == [] -> 52 | wpart_gen:build_html(wpart_gen:tpl_get(upload), 53 | [{"html", wpart:proplist2html(Attrs)}]); 54 | get_html_tag(Attrs, Default) -> 55 | case lists:member($<, Default) of 56 | true -> 57 | wpart_gen:build_html(wpart_gen:tpl_get(upload), 58 | [{"html", wpart:proplist2html(Attrs)}]); 59 | false -> 60 | Path = case Default of 61 | "docroot" ++ P -> 62 | P; 63 | Else -> 64 | Else 65 | end, 66 | 67 | wpart_gen:build_html(wpart_gen:tpl_get(upload), 68 | [{"html", wpart:proplist2html(Attrs)}, 69 | {"comment", wpart_gen:build_html(wpart_gen:tpl_get(upload_edit), 70 | [{"path", Path}])}]) 71 | end. 72 | 73 | load_tpl() -> 74 | wpart_gen:load_tpl(upload_edit, 75 | filename:join([code:priv_dir(wparts),"html","upload_edit.tpl"])), 76 | wpart_gen:load_tpl(upload, 77 | filename:join([code:priv_dir(wparts),"html","upload.tpl"])). 78 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_atom.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Slaski 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_atom). 22 | -behaviour(wtype). 23 | 24 | -include_lib("xmerl/include/xmerl.hrl"). 25 | 26 | -export([handle_call/2, 27 | validate/1]). 28 | 29 | handle_call(_Format, #xmlText{value=Atom}) -> 30 | #xmlText{value=atom_to_list(Atom)}; 31 | handle_call(_Format, Atom) when is_atom(Atom) -> 32 | atom_to_list(Atom). 33 | 34 | validate({_, Atom}) when is_atom(Atom) -> 35 | {ok, Atom}; 36 | validate({_, String}) -> 37 | case catch list_to_existing_atom(String) of 38 | {'EXIT',{badarg,_}} -> 39 | {error, {not_existing, String}}; 40 | Atom -> 41 | {ok, Atom} 42 | end. 43 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_autocomplete.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Zajda 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_autocomplete). 22 | -behaviour(wtype). 23 | 24 | -include_lib("xmerl/include/xmerl.hrl"). 25 | %% API 26 | -export([handle_call/2,validate/1]). 27 | 28 | handle_call(Format, String) -> 29 | wtype_string:handle_call(Format, String). 30 | 31 | validate(X) -> 32 | wtype_string:validate(X). 33 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_bool.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_bool). 22 | -behaviour(wtype). 23 | 24 | -export([handle_call/2, validate/1]). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | handle_call(_Format, true) -> 29 | "true"; 30 | handle_call(_Format, false) -> 31 | "false"; 32 | handle_call(_Format, #xmlText{value=Val}) -> 33 | #xmlText{value=handle_call(not_used, Val)}. 34 | 35 | validate({Types, Val}) -> 36 | case wpart_valid:is_private(Types) of 37 | true -> 38 | {ok, Val =/= undefined}; 39 | false -> 40 | case lists:keysearch(always, 1, Types) of 41 | {_, {_, Bool}} -> 42 | if 43 | Val == undefined, Bool == false -> 44 | {ok, false}; 45 | Val == undefined, Bool == true -> 46 | {error, {bad_bool_value, Val}}; 47 | Bool == false -> 48 | {error, {bad_bool_value, Val}}; 49 | true -> 50 | {ok, true} 51 | end; 52 | _ -> 53 | {ok, Val =/= undefined} 54 | end 55 | end. 56 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_collection.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2009, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @version 1.0 18 | %%% @author Michal Ptaszek 19 | %%% @doc 20 | %%% @end 21 | %%%------------------------------------------------------------------- 22 | 23 | -module(wtype_collection). 24 | -behaviour(wtype). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | -export([handle_call/2,validate/1]). 29 | 30 | handle_call(_Format, #xmlText{value=String}) -> 31 | #xmlText{value=String}; 32 | handle_call(_Format, String) when is_list(String) -> 33 | String. 34 | 35 | validate({Types, undefined}) -> 36 | case wpart_valid:is_private(Types) of 37 | true -> 38 | {ok, undefined}; 39 | false -> 40 | case lists:keysearch(optional, 1, Types) of 41 | {value, {optional, Default}} -> 42 | {ok, Default}; 43 | _ -> 44 | {error, {empty_input, undefined}} 45 | end 46 | end; 47 | 48 | validate({Types, Values}) -> 49 | case check_min_elements(Values, Types) of 50 | {ok, Values} -> 51 | case check_max_elements(Values, Types) of 52 | {ok, Values} -> 53 | check_type(Values, Types); 54 | ErrorMax -> 55 | ErrorMax 56 | end; 57 | ErrorMin -> 58 | ErrorMin 59 | end. 60 | 61 | check_min_elements(Values, Types) -> 62 | case lists:keysearch(min_length, 1, Types) of 63 | {_, {_, N}} when length(Values) < N -> 64 | {error, {not_enough_elements, Values}}; 65 | _ -> 66 | {ok, Values} 67 | end. 68 | 69 | check_max_elements(Values, Types) -> 70 | case lists:keysearch(max_length, 1, Types) of 71 | {_, {_, N}} when length(Values) > N -> 72 | {error, {too_many_elements, Values}}; 73 | _ -> 74 | {ok, Values} 75 | end. 76 | 77 | check_type(Values, Types) -> 78 | {Type, Details} = proplists:get_value(type, Types), 79 | Mod = list_to_atom("wtype_" ++ atom_to_list(Type)), 80 | 81 | Validation = lists:map(fun({_Key, Val}) -> 82 | Mod:validate({Details, Val}) 83 | end, Values), 84 | case lists:keysearch(error, 1, Validation) of 85 | false -> 86 | {ok, lists:reverse(Values)}; 87 | _ -> 88 | {error, Validation} 89 | end. 90 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_csv.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Zajda 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_csv). 22 | -behaviour(wtype). 23 | 24 | -export([handle_call/2, validate/1]). 25 | 26 | handle_call(_, Val) -> 27 | Val. 28 | 29 | validate({Options,undefined}) -> 30 | case wpart_valid:is_private(Options) of 31 | true -> 32 | {ok, undefined}; 33 | false -> 34 | case lists:keysearch(optional, 1, Options) of 35 | {value, {optional, Default}} -> 36 | {ok, Default}; 37 | _ -> 38 | {error, {empty_input, undefined}} 39 | end 40 | end; 41 | 42 | validate({Options, Input}) -> 43 | case wpart_valid:is_private(Options) of 44 | true -> 45 | {ok, Input}; 46 | false -> 47 | {value, {type, Type0}} = lists:keysearch(type, 1, Options), 48 | Type = list_to_atom("wtype_" ++ atom_to_list(Type0)), 49 | 50 | Delimiter = case lists:keysearch(delimiter, 1, Options) of 51 | {_, {_, Del}} -> 52 | Del; 53 | _ -> 54 | "," 55 | end, 56 | 57 | %%TODO: implement nesseccary options 58 | %%{value, {max_val, Max_val}} = lists:keyse 59 | Str = lists:keydelete(type, 1, Options), 60 | List = string:tokens(Input, Delimiter), 61 | ResultList = lists:map( 62 | fun(X) -> 63 | A = apply(Type, validate, [{Str,X}]), 64 | B = tuple_to_list(A), 65 | if 66 | hd(B) =/= ok -> 67 | error; 68 | true -> 69 | A 70 | end 71 | end, 72 | List), 73 | case lists:member(error, ResultList) of 74 | true -> 75 | {error, {wrong_value_in_set, Input}}; 76 | false -> 77 | Ready = lists:map(fun({ok,X}) -> X end, ResultList), 78 | %%Joined = string:join(Ready,",") 79 | {ok,Ready} 80 | end 81 | end. 82 | 83 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_enum.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_enum). 22 | -behaviour(wtype). 23 | 24 | -export([handle_call/2, validate/1]). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | handle_call(_Format, Val) -> 29 | Val. 30 | 31 | validate({Types,undefined}) -> 32 | case wpart_valid:is_private(Types) of 33 | true -> 34 | {ok, undefined}; 35 | false -> 36 | case lists:keysearch(optional, 1, Types) of 37 | {value, {optional, Default}} -> 38 | {ok, Default}; 39 | _ -> 40 | {error, {empty_input, undefined}} 41 | end 42 | end; 43 | 44 | validate({Types, Input}) -> 45 | case wpart_valid:is_private(Types) of 46 | true -> 47 | {ok, Input}; 48 | false -> 49 | if 50 | Input =/= undefined -> 51 | check_choices(Types, Input); 52 | true -> 53 | {error, {empty_input, Input}} 54 | end 55 | end; 56 | 57 | validate(Input) -> {error, {it_is_not_enum_value, Input}}. 58 | 59 | check_choices(Types, Input) -> 60 | case lists:keysearch(choices, 1, Types) of 61 | {_, {_, Choices}} -> 62 | case lists:member(Input, prepare_choices(Choices)) of 63 | true -> 64 | {ok, Input}; 65 | false -> 66 | {error, {no_such_enum_value, Input}} 67 | end; 68 | _ -> 69 | {ok, Input} 70 | end. 71 | 72 | prepare_choices(String) -> 73 | lists:map(fun prepare_choices1/1, string:tokens(String, [$|])). 74 | 75 | prepare_choices1(String) -> 76 | hd(string:tokens(String, [$:])). 77 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_float.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_float). 22 | -behaviour(wtype). 23 | 24 | -include_lib("xmerl/include/xmerl.hrl"). 25 | 26 | -export([handle_call/2, validate/1]). 27 | 28 | handle_call(_Format, #xmlText{value=Float}) -> 29 | #xmlText{value=float_to_list(Float)}; 30 | handle_call("", Float) when is_float(Float) -> 31 | float_to_list(Float); 32 | handle_call(Precision, Float) when is_float(Float) -> 33 | lists:flatten(io_lib:format("~.*..f", [list_to_integer(Precision), Float])). 34 | 35 | validate({Types, undefined}) -> 36 | case wpart_valid:is_private(Types) of 37 | true -> 38 | {ok, undefined}; 39 | false -> 40 | case lists:keysearch(optional, 1, Types) of 41 | {value, {optional, Default}} -> 42 | {ok, Default}; 43 | _ -> 44 | {error, {empty_input, undefined}} 45 | end 46 | end; 47 | 48 | validate({Types,Input}) -> 49 | case wpart_valid:is_private(Types) of 50 | true -> 51 | {ok, Input}; 52 | false -> 53 | case string:to_float(Input) of 54 | {Flt, []} -> 55 | case check_min(Flt, Types) of 56 | {ok, Flt} -> 57 | case check_max(Flt, Types) of 58 | {ok, Flt} -> {ok, Flt}; 59 | ErrorMax -> ErrorMax 60 | end; 61 | ErrorMin -> ErrorMin 62 | end; 63 | {error, no_float} -> 64 | case string:to_integer(Input) of 65 | {Int, []} -> 66 | Flt1 = Int * 1.0, 67 | case check_min(Flt1, Types) of 68 | {ok, Flt1} -> 69 | case check_max(Flt1, Types) of 70 | {ok, Flt1} -> {ok, Flt1}; 71 | ErrorMax -> ErrorMax 72 | end; 73 | ErrorMin -> ErrorMin 74 | end; 75 | _ -> 76 | {error, {not_float, Input}} 77 | end; 78 | _ -> 79 | {error, {not_float, Input}} 80 | end 81 | end. 82 | 83 | check_min(Input, Types) -> 84 | case lists:keysearch(min, 1, Types) of 85 | {value, {min, Min}} -> 86 | if 87 | Input < Min -> 88 | {error, {smaller_than_min, Input}}; 89 | true -> 90 | {ok, Input} 91 | end; 92 | _ -> 93 | {ok, Input} 94 | end. 95 | 96 | check_max(Input, Types) -> 97 | case lists:keysearch(max, 1, Types) of 98 | {value, {max, Max}} -> 99 | if 100 | Input > Max -> 101 | {error, {greater_than_max, Input}}; 102 | true -> 103 | {ok, Input} 104 | end; 105 | _ -> 106 | {ok, Input} 107 | end. 108 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_integer.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | 22 | -module(wtype_integer). 23 | -behaviour(wtype). 24 | 25 | -include_lib("xmerl/include/xmerl.hrl"). 26 | 27 | -export([handle_call/2,validate/1]). 28 | 29 | handle_call(_Format, #xmlText{value=Int}) -> 30 | #xmlText{value=integer_to_list(Int)}; 31 | handle_call(_Format, Int) when is_integer(Int) -> 32 | integer_to_list(Int). 33 | 34 | validate({Types, undefined}) -> 35 | case wpart_valid:is_private(Types) of 36 | true -> 37 | {ok, undefined}; 38 | false -> 39 | case lists:keysearch(optional, 1, Types) of 40 | {value, {optional, Default}} -> 41 | {ok, Default}; 42 | _ -> 43 | {error, {empty_input, undefined}} 44 | end 45 | end; 46 | 47 | validate({Types, Input}) when is_integer(Input) -> 48 | case check_min(Input, Types) of 49 | {ok, Input} -> 50 | case check_max(Input, Types) of 51 | {ok, Input} -> 52 | {ok, Input}; 53 | ErrorMax -> 54 | ErrorMax 55 | end; 56 | ErrorMin -> ErrorMin 57 | end; 58 | validate({Types, Input}) -> 59 | case wpart_valid:is_private(Types) of 60 | true -> 61 | {ok, Input}; 62 | false -> 63 | case catch list_to_integer(Input) of 64 | Int when is_integer(Int) -> 65 | validate({Types, Int}); 66 | _ -> 67 | {error, {not_integer, Input}} 68 | end 69 | end. 70 | 71 | check_min(Input, Types) -> 72 | case lists:keysearch(min, 1, Types) of 73 | {value, {min, Min}} -> 74 | if 75 | Input < Min -> 76 | {error, {smaller_than_min, Input}}; 77 | true -> 78 | {ok, Input} 79 | end; 80 | _ -> 81 | {ok, Input} 82 | end. 83 | 84 | check_max(Input, Types) -> 85 | case lists:keysearch(max, 1, Types) of 86 | {value, {max, Max}} -> 87 | if 88 | Input > Max -> 89 | {error, {greater_than_max, Input}}; 90 | true -> 91 | {ok, Input} 92 | end; 93 | _ -> 94 | {ok, Input} 95 | end. 96 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_multilist.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Zajda 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_multilist). 22 | -behaviour(wtype). 23 | 24 | -include_lib("xmerl/include/xmerl.hrl"). 25 | -export([handle_call/2,validate/1]). 26 | 27 | handle_call(_Format, Val) -> 28 | Val. 29 | 30 | validate({Types, undefined}) -> 31 | case wpart_valid:is_private(Types) of 32 | true -> 33 | {ok, undefined}; 34 | false -> 35 | case lists:keysearch(optional, 1, Types) of 36 | {value, {optional, Default}} -> 37 | {ok, Default}; 38 | _ -> 39 | {error, {empty_input, undefined}} 40 | end 41 | end; 42 | 43 | validate({Types, Input}) -> 44 | case wpart_valid:is_private(Types) of 45 | true -> 46 | one_element_check(Input); 47 | false -> 48 | if 49 | Input =/= undefined -> 50 | one_element_check(Input); 51 | true -> 52 | {error, {empty, Input}} 53 | end 54 | end; 55 | 56 | validate(Input) -> {error, {it_is_not_multiple_list_value, Input}}. 57 | 58 | one_element_check([T | _] = Input) when is_list(T) -> 59 | {ok, Input}; 60 | one_element_check([T | _] = Input) when is_integer(T) -> 61 | {ok, [Input]}; 62 | one_element_check([]) -> 63 | {error, {empty, []}}. 64 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_multiselect.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%------------------------------------------------------------------- 17 | %%% @author Michal Ptaszek 18 | %%% @doc 19 | %%% @end 20 | %%%------------------------------------------------------------------- 21 | -module(wtype_multiselect). 22 | -behaviour(wtype). 23 | 24 | -export([handle_call/2, validate/1]). 25 | 26 | -include_lib("xmerl/include/xmerl.hrl"). 27 | 28 | handle_call(_Format, true) -> 29 | "true"; 30 | handle_call(_Format, false) -> 31 | "false"; 32 | handle_call(_Format, #xmlText{value=Val}) -> 33 | #xmlText{value=handle_call(not_used, Val)}. 34 | 35 | validate({Types, Val}) -> 36 | case wpart_valid:is_private(Types) of 37 | true -> 38 | {ok, Val}; 39 | false -> 40 | Val1 = format_val(Val), 41 | check_always(proplists:get_value(always, Types, []), Val1) 42 | end. 43 | 44 | -spec(check_always/2 :: (list(string()), list(string())) -> {ok, list(string())} | {error, {not_all_mandatory_fields_checked, list(string())}}). 45 | check_always([], Vals) -> 46 | {ok, Vals}; 47 | check_always(Always, Vals) -> 48 | case lists:all(fun(Val) -> 49 | lists:member(Val, Vals) 50 | end, Always) of 51 | true -> 52 | {ok, Vals}; 53 | false -> 54 | {error, {not_all_mandatory_fields_checked, Vals}} 55 | end. 56 | 57 | -spec(format_val/1 :: (undefined | string() | list(string())) -> list(string())). 58 | format_val(undefined) -> 59 | []; 60 | format_val(Val) when is_integer(hd(Val)) -> 61 | [Val]; 62 | format_val(Val) -> 63 | Val. 64 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/src/wtype_term.erl: -------------------------------------------------------------------------------- 1 | %% The contents of this file are subject to the Erlang Web Public License, 2 | %% Version 1.0, (the "License"); you may not use this file except in 3 | %% compliance with the License. You should have received a copy of the 4 | %% Erlang Web Public License along with this software. If not, it can be 5 | %% retrieved via the world wide web at http://www.erlang-consulting.com/. 6 | %% 7 | %% Software distributed under the License is distributed on an "AS IS" 8 | %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 | %% the License for the specific language governing rights and limitations 10 | %% under the License. 11 | %% 12 | %% The Initial Developer of the Original Code is Erlang Training & Consulting 13 | %% Ltd. Portions created by Erlang Training & Consulting Ltd are Copyright 2008, 14 | %% Erlang Training & Consulting Ltd. All Rights Reserved. 15 | 16 | %%%============================================================================= 17 | %%% @author Adam Lindberg 18 | %%% @doc Generic term formatter based on {@module io_lib}· 19 | %%% @end 20 | %%%============================================================================= 21 | -module(wtype_term). 22 | -author('code@erlang-consulting.com'). 23 | -copyright('Erlang Training & Consulting Ltd.'). 24 | -vsn("$Rev$"). 25 | 26 | %% Exported formatters. 27 | -export([handle_call/2]). 28 | 29 | %%============================================================================== 30 | %% Exported formatters. 31 | %%============================================================================== 32 | %%------------------------------------------------------------------------------ 33 | %% @spec handle_call(Format, Term) -> Result 34 | %% Format = [] | string() 35 | %% Term = term() 36 | %% Result = string() 37 | %% 38 | %% @doc Formats the data with {@link io_lib:format/2}, if `Format' is `[]' it 39 | %% defaults to `~w' formatting. 40 | %% @end 41 | %%------------------------------------------------------------------------------ 42 | handle_call([], Term) -> 43 | io_lib:format("~w", [Term]); 44 | handle_call(Format, Term) -> 45 | io_lib:format(Format, [Term]). 46 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/tests/Emakefile: -------------------------------------------------------------------------------- 1 | {'*', [{outdir, "../ebin"}, {i, "../include"}, debug_info, strict_record_tests, netload]}. 2 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/tests/datetime_format_tests.erl: -------------------------------------------------------------------------------- 1 | -module(datetime_format_tests). 2 | 3 | -include_lib("eunit/include/eunit.hrl"). 4 | 5 | get_time_new_syntax_test() -> 6 | ?assertEqual("13:37:35", wtype_time:format("HH:NN:SS", {13, 37, 35})), 7 | ?assertEqual("13:37:35", wtype_time:get_time("HH:NN:SS", {13, 37, 35})). 8 | 9 | get_time_old_syntax_test() -> 10 | ?assertEqual("13:37:35", wtype_time:format("HH:MM:SS", {13, 37, 35})), 11 | ?assertEqual("13:37:35", wtype_time:get_time("HH:MM:SS", {13, 37, 35})). 12 | 13 | validate_new_syntax_test() -> 14 | ?assertEqual({ok, {13, 37, 35}}, 15 | wtype_time:validate({[{format, "HH:NN:SS"}], "13:37:35"})). 16 | 17 | validate_old_syntax_test() -> 18 | ?assertEqual({ok, {13, 37, 35}}, 19 | wtype_time:validate({[{format, "HH:MM:SS"}], "13:37:35"})). 20 | 21 | get_date_test() -> 22 | ?assertEqual("24.07.1986", wtype_date:get_date("DD.MM.YYYY", {1986, 07, 24})). 23 | 24 | validate_date_test() -> 25 | ?assertEqual({ok, {1986, 07, 24}}, 26 | wtype_date:validate({[{format, "DD.MM.YYYY"}], "24.07.1986"})). 27 | -------------------------------------------------------------------------------- /lib/wparts-1.4.1/tests/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | cd ../../.. 3 | ./bin/compile.erl 4 | cd - 5 | erl -make 6 | erl -pa ../ebin/ ../../wpart-1.4.1/ebin/ -s datetime_format_tests test -s init stop 7 | -------------------------------------------------------------------------------- /lib/yaws-1.85/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2006, Claes Wikstrom, klacke@hyber.org 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of "Yaws" nor the names of its contributors may be 14 | used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/.empty -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/authmod_gssapi.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/authmod_gssapi.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/haxe.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/haxe.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/json.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/json.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/jsonrpc.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/jsonrpc.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/mime_type_c.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/mime_type_c.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/mime_types.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/mime_types.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws.app: -------------------------------------------------------------------------------- 1 | {application,yaws, 2 | [{description,"yaws WWW server"}, 3 | {vsn,"1.85"}, 4 | {modules,[yaws, yaws_app, yaws_ticker, yaws_config, yaws_server, yaws_sup, yaws_api, yaws_log, yaws_ls, yaws_debug, yaws_compile, yaws_ctl, yaws_cgi, yaws_zlib, yaws_generated, mime_type_c, mime_types, yaws_session_server, yaws_outmod, yaws_revproxy, yaws_html, yaws_log_file_h, yaws_rss, yaws_dav, yaws_pam, json, jsonrpc, yaws_jsonrpc, yaws_xmlrpc, haxe, yaws_rpc, yaws_soap_srv, yaws_soap_lib, authmod_gssapi, yaws_appmod_cgi, yaws_appmod_fcgi, yaws_sendfile, yaws_sendfile_compat, yaws_sup_restarts, yaws_stats, yaws_multipart]}, 5 | {registered, []}, 6 | {mod,{yaws_app,[]}}, 7 | {env, [ 8 | % {debug, false}, % true | false 9 | % {trace, false}, % http | traffic | false 10 | % {traceoutput, false}, % true | false 11 | % {conf, "/etc/yaws.conf"}, % string() 12 | % {runmod, mymodule}, % atom() 13 | % {embedded, false}, % true | false 14 | % {id, "default"}, % string() 15 | % {pam_service, "system-auth"}, % string() 16 | % {pam_use_acct, true}, % true | false 17 | % {pam_use_sess, true} % true | false 18 | ]}, 19 | {applications,[kernel,stdlib]}]}. 20 | -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_api.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_api.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_app.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_app.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_appmod_cgi.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_appmod_cgi.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_appmod_fcgi.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_appmod_fcgi.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_cgi.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_cgi.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_compile.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_compile.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_config.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_config.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_ctl.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_ctl.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_dav.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_dav.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_debug.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_debug.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_generated.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_generated.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_html.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_html.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_jsonrpc.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_jsonrpc.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_log.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_log.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_log_file_h.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_log_file_h.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_ls.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_ls.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_multipart.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_multipart.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_outmod.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_outmod.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_pam.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_pam.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_revproxy.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_revproxy.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_rpc.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_rpc.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_rss.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_rss.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_sendfile.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_sendfile.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_sendfile_compat.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_sendfile_compat.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_server.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_server.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_session_server.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_session_server.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_soap_lib.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_soap_lib.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_soap_srv.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_soap_srv.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_stats.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_stats.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_sup.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_sup.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_sup_restarts.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_sup_restarts.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_ticker.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_ticker.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_xmlrpc.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_xmlrpc.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/ebin/yaws_zlib.beam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/ebin/yaws_zlib.beam -------------------------------------------------------------------------------- /lib/yaws-1.85/include/erlsom.hrl: -------------------------------------------------------------------------------- 1 | %%% ==================================================================== 2 | %%% Header file for erlsom 3 | %%% 4 | %%% Copyright (C) 2006 Willem de Jong 5 | %%% 6 | %%% This program is free software; you can redistribute it and/or modify 7 | %%% it under the terms of the GNU General Public License as published by 8 | %%% the Free Software Foundation; either version 2 of the License, or 9 | %%% (at your option) any later version. 10 | %%% 11 | %%% This program is distributed in the hope that it will be useful, but 12 | %%% WITHOUT ANY WARRANTY; without even the implied warranty of 13 | %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | %%% General Public License for more details. 15 | %%% 16 | %%% You should have received a copy of the GNU General Public License 17 | %%% along with this program; if not, write to the Free Software 18 | %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 19 | %%% USA 20 | %%% 21 | %%% Author contact: w.a.de.jong@gmail.com 22 | %%% ==================================================================== 23 | 24 | %%% version: 0.0.2 25 | 26 | %% prefix=the prefix that will be used in the result 27 | -ifndef(_ERLSOM_HRL_). 28 | -define(_ERLSOM_HRL_, true). 29 | 30 | 31 | -record(ns, {uri, prefix}). 32 | -record(qname, {uri, localPart, prefix, mappedPrefix}). 33 | 34 | -endif. 35 | -------------------------------------------------------------------------------- /lib/yaws-1.85/include/yaws_dav.hrl: -------------------------------------------------------------------------------- 1 | -ifndef(_YAWS_DAV). 2 | -define(_YAWS_DAV, true). 3 | 4 | -record(propfind, { 5 | prop = [], 6 | uri = "" 7 | }). 8 | 9 | 10 | 11 | -endif. 12 | -------------------------------------------------------------------------------- /lib/yaws-1.85/priv/lib/setuid_drv.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/priv/lib/setuid_drv.so -------------------------------------------------------------------------------- /lib/yaws-1.85/priv/lib/yaws_sendfile_drv.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esl/erlang-web/2e5c2c9725465fc5b522250c305a9d553b3b8243/lib/yaws-1.85/priv/lib/yaws_sendfile_drv.so --------------------------------------------------------------------------------