PageRenderTime 23ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/_plugins_/spip_fckeditor/spip_fck/filemanager/browser/spip/frmfolders.html

https://bitbucket.org/pombredanne/spip-zone-treemap
HTML | 192 lines | 142 code | 31 blank | 19 comment | 0 complexity | 96c2d0941d4a11c41c68b669432ee598 MD5 | raw file
  1. <!--
  2. * FCKeditor - The text editor for internet
  3. * Copyright (C) 2003-2006 Frederico Caldeira Knabben
  4. *
  5. * Licensed under the terms of the GNU Lesser General Public License:
  6. * http://www.opensource.org/licenses/lgpl-license.php
  7. *
  8. * For further information visit:
  9. * http://www.fckeditor.net/
  10. *
  11. * "Support Open Source software. What about a donation today?"
  12. *
  13. * File Name: frmfolders.html
  14. * This page shows the list of folders available in the parent folder
  15. * of the current folder.
  16. *
  17. * File Authors:
  18. * Frederico Caldeira Knabben (fredck@fckeditor.net)
  19. -->
  20. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  21. <html>
  22. <head>
  23. <link href="browser.css" type="text/css" rel="stylesheet">
  24. <script type="text/javascript" src="js/common.js"></script>
  25. <script language="javascript">
  26. var sActiveFolder ;
  27. var bIsLoaded = false ;
  28. var iIntervalId ;
  29. var oListManager = new Object() ;
  30. oListManager.Init = function()
  31. {
  32. this.Table = document.getElementById('tableFiles') ;
  33. this.UpRow = document.getElementById('trUp') ;
  34. this.TableRows = new Object() ;
  35. }
  36. oListManager.Clear = function()
  37. {
  38. // Remove all other rows available.
  39. while ( this.Table.rows.length > 1 )
  40. this.Table.deleteRow(1) ;
  41. // Reset the TableRows collection.
  42. this.TableRows = new Object() ;
  43. }
  44. oListManager.AddItem = function( folderName, folderPath )
  45. {
  46. // Create the new row.
  47. var oRow = this.Table.insertRow(-1) ;
  48. oRow.className = 'FolderListFolder' ;
  49. // Build the link to view the folder.
  50. var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
  51. // Add the folder icon cell.
  52. var oCell = oRow.insertCell(-1) ;
  53. oCell.width = 16 ;
  54. oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
  55. // Add the folder name cell.
  56. oCell = oRow.insertCell(-1) ;
  57. oCell.noWrap = true ;
  58. oCell.innerHTML = '&nbsp;' + sLink + folderName + '</a>' ;
  59. this.TableRows[ folderPath ] = oRow ;
  60. }
  61. oListManager.ShowUpFolder = function( upFolderPath )
  62. {
  63. this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
  64. if ( upFolderPath != null )
  65. {
  66. document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
  67. {
  68. LoadFolders( upFolderPath ) ;
  69. return false ;
  70. }
  71. }
  72. }
  73. function CheckLoaded()
  74. {
  75. if ( window.top.IsLoadedActualFolder
  76. && window.top.IsLoadedCreateFolder
  77. && window.top.IsLoadedUpload
  78. && window.top.IsLoadedResourcesList )
  79. {
  80. window.clearInterval( iIntervalId ) ;
  81. bIsLoaded = true ;
  82. OpenFolder( sActiveFolder ) ;
  83. }
  84. }
  85. function OpenFolder( folderPath )
  86. {
  87. sActiveFolder = folderPath ;
  88. if ( ! bIsLoaded )
  89. {
  90. if ( ! iIntervalId )
  91. iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
  92. return ;
  93. }
  94. // Change the style for the select row (to show the opened folder).
  95. for ( var sFolderPath in oListManager.TableRows )
  96. {
  97. oListManager.TableRows[ sFolderPath ].className =
  98. ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
  99. }
  100. // Set the current folder in all frames.
  101. window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
  102. window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
  103. window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
  104. // Load the resources list for this folder.
  105. window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
  106. }
  107. function LoadFolders( folderPath )
  108. {
  109. // Clear the folders list.
  110. oListManager.Clear() ;
  111. // Get the parent folder path.
  112. var sParentFolderPath ;
  113. if ( folderPath != '/' )
  114. sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
  115. // Show/Hide the Up Folder.
  116. oListManager.ShowUpFolder( sParentFolderPath ) ;
  117. if ( folderPath != '/' )
  118. {
  119. sActiveFolder = folderPath ;
  120. oConnector.CurrentFolder = sParentFolderPath
  121. oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
  122. }
  123. else
  124. OpenFolder( '/' ) ;
  125. }
  126. function GetFoldersCallBack( fckXml )
  127. {
  128. if ( oConnector.CheckError( fckXml ) != 0 )
  129. return ;
  130. // Get the current folder path.
  131. var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
  132. var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
  133. var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
  134. for ( var i = 0 ; i < oNodes.length ; i++ )
  135. {
  136. var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
  137. oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
  138. }
  139. OpenFolder( sActiveFolder ) ;
  140. }
  141. function SetResourceType( type )
  142. {
  143. oConnector.ResourceType = type ;
  144. LoadFolders( '/' ) ;
  145. }
  146. window.onload = function()
  147. {
  148. oListManager.Init() ;
  149. LoadFolders( '/' ) ;
  150. }
  151. </script>
  152. </head>
  153. <body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
  154. <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
  155. <tr id="trUp" style="DISPLAY: none">
  156. <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
  157. <td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
  158. </tr>
  159. </table>
  160. </body>
  161. </html>