examples.html 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <html>
  2. <head>
  3. <title>MCImageManager Example</title>
  4. <script type="text/javascript" src="js/mcimagemanager.js"></script>
  5. <style>
  6. body, input { font-family: Arial, Verdana; font-size: 11px; }
  7. h3 { font-size: 14px; }
  8. p { margin: 0; padding: 0; margin-bottom: 3px; }
  9. </style>
  10. </head>
  11. <body>
  12. <h3>Simple example</h3>
  13. <p>This is the most simple form of integration.</p>
  14. <form name="example1">
  15. <input type="text" name="url" value="Select file" size="80">
  16. <a href="javascript:mcImageManager.open('example1','url');">[MCImageManager]</a>
  17. </form>
  18. <h3>Relative URL example</h3>
  19. <p>This example will output the selected files as relative to the current document.</p>
  20. <form name="example2">
  21. <input type="text" name="url" value="" size="80" />
  22. <a href="javascript:mcImageManager.open('example2','url','','',{relative_urls : true});">[MCImageManager]</a>
  23. </form>
  24. <h3>Absolute URL with document_base_url option</h3>
  25. <p>This example will output the selected files as absolute URLs but with a different domain prefix.</p>
  26. <form name="example7">
  27. <input type="text" name="url" value="" size="80" />
  28. <a href="javascript:mcImageManager.open('example7','url','','',{document_base_url : 'http://tinymce.moxiecode.com/', remember_last_path : 1});">[MCImageManager]</a>
  29. </form>
  30. <h3>Absolute URL without host</h3>
  31. <p>This example will output the selected files as absolute URLs but without the protocol and host name parts.</p>
  32. <form name="example3">
  33. <input type="text" name="url" value="" size="80" />
  34. <a href="javascript:mcImageManager.open('example3','url','','',{remove_script_host : true});">[MCImageManager]</a>
  35. </form>
  36. <h3>Specify default path</h3>
  37. <p>This example shows how the default path can be specified with JavaScript, it also disables the remember last path feature.</p>
  38. <form name="example4">
  39. <input type="text" name="url" value="" size="80" />
  40. <a href="javascript:mcImageManager.open('example4','url','','',{path : 'files/moreimages', remember_last_path : false});">[MCImageManager]</a>
  41. </form>
  42. <h3>Specify rootpath</h3>
  43. <p>This example shows how the rootpath can be specified with JavaScript.</p>
  44. <form name="example5">
  45. <input type="text" name="url" value="" size="80" />
  46. <a href="javascript:mcImageManager.open('example5','url','','',{rootpath : 'files/moreimages'});">[MCImageManager]</a>
  47. </form>
  48. <h3>Custom JavaScript insert script</h3>
  49. <p>This example shows how one could implement a custom insertion JavaScript.</p>
  50. <script type="text/javascript">
  51. function insertURL(url, data) {
  52. alert("A URL was intercepted: " + url + "\nsize: " + data.custom.width + "," + data.custom.height);
  53. document.forms['example6'].url.value = url;
  54. }
  55. </script>
  56. <form name="example6">
  57. <input type="text" name="url" value="" size="80" />
  58. <a href="javascript:mcImageManager.open('example6','url','','insertURL');">[MCImageManager]</a>
  59. </form>
  60. <h3>Custom filter script</h3>
  61. <p>This example shows you how to change/filter data passed back.</p>
  62. <script type="text/javascript">
  63. function filterURL(file) {
  64. alert("Data was intercepted: URL: " + file.url + "\nsize: " + file.custom.width + "," + file.custom.height);
  65. file.url = file.url.toUpperCase();
  66. }
  67. </script>
  68. <form name="example8">
  69. <input type="text" name="url" value="" size="80" />
  70. <a href="javascript:mcImageManager.open('example8','url','','',{insert_filter : filterURL});">[MCImageManager]</a>
  71. </form>
  72. <h3>Filtered file list example</h3>
  73. <p>This is the most simple form of integration.</p>
  74. <p><a href="javascript:mcImageManager.browse({extensions:'jpg', exclude_file_pattern:'/^dog/'});">[MCImageManager]</a></p>
  75. </body>
  76. </html>