/modules/mod_base/dispatch/dispatch

https://code.google.com/p/zotonic/ · #! · 93 lines · 74 code · 19 blank · 0 comment · 0 complexity · c9eabe73eb8aeedc32dc1af15f1533cf MD5 · raw file

  1. %% Base dispatch rules for zotonic
  2. [
  3. %% The home page, just shows the "home.tpl" template.
  4. {home, [], resource_template, [ {template, "home.tpl"} ]},
  5. %% Comet connection, used with long polls from the browser.
  6. {comet, ["comet"], resource_comet, [{ssl, any}]},
  7. %% Comet sub-domain connection, used with long polls from the browser.
  8. {comet, ["comet", "subdomain"], resource_template, [{template, "comet_subdomain.tpl"}]},
  9. %% WebSocket connection.
  10. {websocket, ["websocket"], resource_websocket, [{ssl, any}]},
  11. %% Postback of events from the browser to the server, dispatched from the postback resource.
  12. {postback, ["postback"], resource_postback, [{ssl, any}]},
  13. %% Used in Ajax file upload, fixes a problem in Safari. Just closes the connection.
  14. {close_connection, ["close-connection"], resource_close_connection, [{ssl, any}]},
  15. %% Normal page to show a resource.
  16. {page, ["page", id], resource_page, [ {template, {cat, "page.tpl"}} ]},
  17. {page, ["page", id, slug], resource_page, [ {template, {cat, "page.tpl"}} ]},
  18. %% The id controller redirects depending on the accept header sent by the user agent.
  19. {id, ["id", id], resource_id, []},
  20. % CSS and Javascript files from the "lib" module folder. Possibly more than one file combined in one request.
  21. {lib, ["lib",'*'], resource_lib, [ {use_cache, false}, {ssl, any} ]},
  22. % Redirect controller for resource of type 'website'
  23. {website, ["redirect", id, slug], resource_website_redirect, []},
  24. %% Resized images, expects resize parameters and a checksum. Places resized images in the root folder.
  25. %% The original images must be present in the media_path.
  26. {image, ["image",'*'], resource_file_readonly, [
  27. {use_cache, false},
  28. {is_media_preview, true},
  29. {ssl, any}
  30. ]},
  31. %% Download of an image, attached to a media rsc
  32. {media_attachment, ["media","attachment","id",id], resource_file_readonly, [
  33. {path, id},
  34. {use_cache, false},
  35. {content_disposition, attachment}
  36. ]},
  37. %% Download of an image, attached to a media rsc
  38. {media_inline, ["media","inline","id",id], resource_file_readonly, [
  39. {path, id},
  40. {use_cache, false},
  41. {content_disposition, inline}
  42. ]},
  43. %% Inline display of original uploaded files. Assumes the files are in the root folder.
  44. {media_inline, ["media","inline",'*'], resource_file_readonly, [
  45. {use_cache, false},
  46. {content_disposition, inline}
  47. ]},
  48. %% Download of original uploaded files. Assumes the files are in the root folder.
  49. {media_attachment, ["media","attachment",'*'], resource_file_readonly, [
  50. {use_cache, false},
  51. {content_disposition, attachment}
  52. ]},
  53. %% API access
  54. {api, ["api",module,method], resource_api, []},
  55. {api, ["api",module], resource_api, [{method_is_module, true}]},
  56. %% Serves the favicon.ico from "lib/images/favicon.ico" in the modules.
  57. {favicon, ["favicon.ico"], resource_file_readonly, [
  58. {path, "images/favicon.ico"},
  59. {root,[lib]},
  60. {use_cache, false},
  61. {content_disposition, inline},
  62. {ssl, any}
  63. ]},
  64. %% robots.txt - simple allow all file
  65. {robots_txt, ["robots.txt"], resource_file_readonly, [
  66. {path, "misc/robots.txt"},
  67. {root,[lib]},
  68. {use_cache, false},
  69. {content_disposition, inline}
  70. ]}
  71. %% "Last resort" we check the request path against the page_path of resources and redirect to
  72. %% the page configured for the page path.
  73. %% {page_path, ['*'], resource_page_path, []}
  74. ].