/pigeoncms/Plugins/fckeditor/editor/filemanager/browser/default/frmresourceslist.html

http://pigeoncms.googlecode.com/ · HTML · 169 lines · 122 code · 25 blank · 22 comment · 0 complexity · 40b8f3e85793f9b87680ce5f5f557631 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <!--
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2009 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * This page shows all resources available in a folder in the File Browser.
  23. -->
  24. <html>
  25. <head>
  26. <title>Resources</title>
  27. <link href="browser.css" type="text/css" rel="stylesheet">
  28. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  29. <script type="text/javascript" src="js/common.js"></script>
  30. <script type="text/javascript">
  31. var oListManager = new Object() ;
  32. oListManager.Clear = function()
  33. {
  34. document.body.innerHTML = '' ;
  35. }
  36. function ProtectPath(path)
  37. {
  38. path = path.replace( /\\/g, '\\\\') ;
  39. path = path.replace( /'/g, '\\\'') ;
  40. return path ;
  41. }
  42. oListManager.GetFolderRowHtml = function( folderName, folderPath )
  43. {
  44. // Build the link to view the folder.
  45. var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
  46. return '<tr>' +
  47. '<td width="16">' +
  48. sLink +
  49. '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
  50. '<\/td><td nowrap colspan="2">&nbsp;' +
  51. sLink +
  52. folderName +
  53. '<\/a>' +
  54. '<\/td><\/tr>' ;
  55. }
  56. oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
  57. {
  58. // Build the link to view the folder.
  59. var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
  60. // Get the file icon.
  61. var sIcon = oIcons.GetIcon( fileName ) ;
  62. return '<tr>' +
  63. '<td width="16">' +
  64. sLink +
  65. '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
  66. '<\/td><td>&nbsp;' +
  67. sLink +
  68. fileName +
  69. '<\/a>' +
  70. '<\/td><td align="right" nowrap>&nbsp;' +
  71. fileSize +
  72. ' KB' +
  73. '<\/td><\/tr>' ;
  74. }
  75. function OpenFolder( folderPath )
  76. {
  77. // Load the resources list for this folder.
  78. window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
  79. }
  80. function OpenFile( fileUrl )
  81. {
  82. window.top.opener.SetUrl( encodeURI( fileUrl ).replace( '#', '%23' ) ) ;
  83. window.top.close() ;
  84. window.top.opener.focus() ;
  85. }
  86. function LoadResources( resourceType, folderPath )
  87. {
  88. oListManager.Clear() ;
  89. oConnector.ResourceType = resourceType ;
  90. oConnector.CurrentFolder = folderPath ;
  91. oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
  92. }
  93. function Refresh()
  94. {
  95. LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
  96. }
  97. function GetFoldersAndFilesCallBack( fckXml )
  98. {
  99. if ( oConnector.CheckError( fckXml ) != 0 )
  100. return ;
  101. // Get the current folder path.
  102. var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
  103. if ( oFolderNode == null )
  104. {
  105. alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
  106. return ;
  107. }
  108. var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
  109. var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
  110. // var dTimer = new Date() ;
  111. var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
  112. // Add the Folders.
  113. var oNodes ;
  114. oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
  115. for ( var i = 0 ; i < oNodes.length ; i++ )
  116. {
  117. var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
  118. oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
  119. }
  120. // Add the Files.
  121. oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
  122. for ( var j = 0 ; j < oNodes.length ; j++ )
  123. {
  124. var oNode = oNodes[j] ;
  125. var sFileName = oNode.attributes.getNamedItem('name').value ;
  126. var sFileSize = oNode.attributes.getNamedItem('size').value ;
  127. // Get the optional "url" attribute. If not available, build the url.
  128. var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
  129. var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
  130. oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
  131. }
  132. oHtml.Append( '<\/table>' ) ;
  133. document.body.innerHTML = oHtml.ToString() ;
  134. // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
  135. }
  136. window.onload = function()
  137. {
  138. window.top.IsLoadedResourcesList = true ;
  139. }
  140. </script>
  141. </head>
  142. <body class="FileArea">
  143. </body>
  144. </html>