1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>ImgLib v.0.1.1</title>
  6. <link href="css/imglib.css" type="text/css" rel="stylesheet" />
  7. </head>
  8. <body>
  9. <div id="imgLibContainer">
  10. <div id="imgLib">
  11. <noscript>imgLib requires JavaScript to run!</noscript>
  12. </div>
  13. </div>
  14. <div id="controls">
  15. <div id="info"><span id="select_file_label">Selected file</span>: <span id="file_path_label"></span></div>
  16. <a href="#" id="select" class="gray_btn" onclick="return imgLibManager.select();">Select</a>
  17. <a href="#" id="cancel" class="red_btn" onclick="window.close();">Cancel</a>
  18. </div>
  19.  
  20. <script type="text/javascript" src="css/core.js"></script>
  21. <script type="text/javascript" src="css/imglib.js"></script>
  22. <script type="text/javascript">
  23. var params = getURLArg(); // Get window arguments as object
  24. /**************************** Height adjust *******************************/
  25. addEvent(window, 'resize', adjustHeight);
  26. addEvent(window, 'load', adjustHeight);
  27. function adjustHeight() {
  28. var
  29. winGeom = getWindowGeometry(),
  30. controlsEl = $('controls'),
  31. controlsGeom = getElPos(controlsEl)
  32. ;
  33. $('imgLib').style.height = (winGeom.height - controlsGeom.height - 14) + 'px';
  34. }
  35. /*********************** Set the start path to browse ********************/
  36. if (params.path) {
  37. imgLib.setStartPath(params.path);
  38. }
  39. /**************************** Selection files *******************************/
  40. var imgLibManager = {
  41. selectedFile: null,
  42. init: function () {
  43. // Here goes your code for setting your custom things onLoad.
  44. },
  45. onSelect: function (file) {
  46. // Save selected file and indicate the selection
  47. imgLibManager.selectedFile = file;
  48. $('select').className = 'gren_btn';
  49. $('file_path_label').innerHTML = file.path + ' (' + getFloatSize(file.filesize) + ')';
  50. },
  51. onDeselect: function () {
  52. // Clear selected file
  53. imgLibManager.selectedFile = null;
  54. $('select').className = 'gray_btn';
  55. $('file_path_label').innerHTML = '';
  56. },
  57. select: function () {
  58. // Insert selected file
  59. if (!imgLibManager.selectedFile) {
  60. return false;
  61. }
  62. if (params.returnto) {
  63. if ( (typeof opener[params.returnto] == 'function') || (typeof opener[params.returnto] == 'object') ) {
  64. // window.returnto - function (or object in IE) created by opener window to get the selected file path
  65. opener[params.returnto](imgLibManager.selectedFile.wwwPath, imgLibManager.selectedFile);
  66. } else if (opener.document.getElementById(params.returnto)) {
  67. // returnto - some element to insert the selected file path
  68. var return_element = opener.document.getElementById(params.returnto);
  69. // Set the value property if returnto is input element, and innerHTML if it a regular HTML tag
  70. return_element.innerHTML = imgLibManager.selectedFile.wwwPath;
  71. return_element.value =imgLibManager.selectedFile.wwwPath;
  72. }
  73. window.close();
  74. } else {
  75. // Else do nothing
  76. return false;
  77. }
  78. }
  79. };
  80. </script>
  81. <script type="text/javascript" src="imglib.php?imglib_config=1"></script>
  82. </body>
  83. </html>