event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / filemanager / browser / default / frmfolders.html
diff --git a/httemplate/elements/fckeditor/editor/filemanager/browser/default/frmfolders.html b/httemplate/elements/fckeditor/editor/filemanager/browser/default/frmfolders.html
new file mode 100644 (file)
index 0000000..2dc0eb0
--- /dev/null
@@ -0,0 +1,196 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
+<!--\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ *  - GNU General Public License Version 2 or later (the "GPL")\r
+ *    http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ *    http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ *    http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * This page shows the list of folders available in the parent folder\r
+ * of the current folder.\r
+-->\r
+<html>\r
+       <head>\r
+               <link href="browser.css" type="text/css" rel="stylesheet">\r
+               <script type="text/javascript" src="js/common.js"></script>\r
+               <script language="javascript">\r
+\r
+var sActiveFolder ;\r
+\r
+var bIsLoaded = false ;\r
+var iIntervalId ;\r
+\r
+var oListManager = new Object() ;\r
+\r
+oListManager.Init = function()\r
+{\r
+       this.Table = document.getElementById('tableFiles') ;\r
+       this.UpRow = document.getElementById('trUp') ;\r
+\r
+       this.TableRows = new Object() ;\r
+}\r
+\r
+oListManager.Clear = function()\r
+{\r
+       // Remove all other rows available.\r
+       while ( this.Table.rows.length > 1 )\r
+               this.Table.deleteRow(1) ;\r
+\r
+       // Reset the TableRows collection.\r
+       this.TableRows = new Object() ;\r
+}\r
+\r
+oListManager.AddItem = function( folderName, folderPath )\r
+{\r
+       // Create the new row.\r
+       var oRow = this.Table.insertRow(-1) ;\r
+       oRow.className = 'FolderListFolder' ;\r
+\r
+       // Build the link to view the folder.\r
+       var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;\r
+\r
+       // Add the folder icon cell.\r
+       var oCell = oRow.insertCell(-1) ;\r
+       oCell.width = 16 ;\r
+       oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;\r
+\r
+       // Add the folder name cell.\r
+       oCell = oRow.insertCell(-1) ;\r
+       oCell.noWrap = true ;\r
+       oCell.innerHTML = '&nbsp;' + sLink + folderName + '</a>' ;\r
+\r
+       this.TableRows[ folderPath ] = oRow ;\r
+}\r
+\r
+oListManager.ShowUpFolder = function( upFolderPath )\r
+{\r
+       this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;\r
+\r
+       if ( upFolderPath != null )\r
+       {\r
+               document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()\r
+               {\r
+                       LoadFolders( upFolderPath ) ;\r
+                       return false ;\r
+               }\r
+       }\r
+}\r
+\r
+function CheckLoaded()\r
+{\r
+       if ( window.top.IsLoadedActualFolder\r
+               && window.top.IsLoadedCreateFolder\r
+               && window.top.IsLoadedUpload\r
+               && window.top.IsLoadedResourcesList )\r
+       {\r
+               window.clearInterval( iIntervalId ) ;\r
+               bIsLoaded = true ;\r
+               OpenFolder( sActiveFolder ) ;\r
+       }\r
+}\r
+\r
+function OpenFolder( folderPath )\r
+{\r
+       sActiveFolder = folderPath ;\r
+\r
+       if ( ! bIsLoaded )\r
+       {\r
+               if ( ! iIntervalId )\r
+                       iIntervalId = window.setInterval( CheckLoaded, 100 ) ;\r
+               return ;\r
+       }\r
+\r
+       // Change the style for the select row (to show the opened folder).\r
+       for ( var sFolderPath in oListManager.TableRows )\r
+       {\r
+               oListManager.TableRows[ sFolderPath ].className =\r
+                       ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;\r
+       }\r
+\r
+       // Set the current folder in all frames.\r
+       window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
+       window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
+       window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
+\r
+       // Load the resources list for this folder.\r
+       window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;\r
+}\r
+\r
+function LoadFolders( folderPath )\r
+{\r
+       // Clear the folders list.\r
+       oListManager.Clear() ;\r
+\r
+       // Get the parent folder path.\r
+       var sParentFolderPath ;\r
+       if ( folderPath != '/' )\r
+               sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;\r
+\r
+       // Show/Hide the Up Folder.\r
+       oListManager.ShowUpFolder( sParentFolderPath ) ;\r
+\r
+       if ( folderPath != '/' )\r
+       {\r
+               sActiveFolder = folderPath ;\r
+               oConnector.CurrentFolder = sParentFolderPath ;\r
+               oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;\r
+       }\r
+       else\r
+               OpenFolder( '/' ) ;\r
+}\r
+\r
+function GetFoldersCallBack( fckXml )\r
+{\r
+       if ( oConnector.CheckError( fckXml ) != 0 )\r
+               return ;\r
+\r
+       // Get the current folder path.\r
+       var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;\r
+       var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;\r
+\r
+       var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;\r
+\r
+       for ( var i = 0 ; i < oNodes.length ; i++ )\r
+       {\r
+               var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;\r
+               oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;\r
+       }\r
+\r
+       OpenFolder( sActiveFolder ) ;\r
+}\r
+\r
+function SetResourceType( type )\r
+{\r
+       oConnector.ResourceType = type ;\r
+       LoadFolders( '/' ) ;\r
+}\r
+\r
+window.onload = function()\r
+{\r
+       oListManager.Init() ;\r
+       LoadFolders( '/' ) ;\r
+}\r
+               </script>\r
+       </head>\r
+       <body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">\r
+               <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">\r
+                       <tr id="trUp" style="DISPLAY: none">\r
+                               <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>\r
+                               <td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>\r
+                       </tr>\r
+               </table>\r
+       </body>\r
+</html>\r