import torrus 1.0.9
[freeside.git] / httemplate / elements / fckeditor / editor / filemanager / browser / default / frmfolders.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
2 <!--\r
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
4  * Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
5  *\r
6  * == BEGIN LICENSE ==\r
7  *\r
8  * Licensed under the terms of any of the following licenses at your\r
9  * choice:\r
10  *\r
11  *  - GNU General Public License Version 2 or later (the "GPL")\r
12  *    http://www.gnu.org/licenses/gpl.html\r
13  *\r
14  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
15  *    http://www.gnu.org/licenses/lgpl.html\r
16  *\r
17  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
18  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
19  *\r
20  * == END LICENSE ==\r
21  *\r
22  * This page shows the list of folders available in the parent folder\r
23  * of the current folder.\r
24 -->\r
25 <html>\r
26         <head>\r
27                 <title>Folders</title>\r
28                 <link href="browser.css" type="text/css" rel="stylesheet">\r
29                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
30                 <script type="text/javascript" src="js/common.js"></script>\r
31                 <script type="text/javascript">\r
32 \r
33 var sActiveFolder ;\r
34 \r
35 var bIsLoaded = false ;\r
36 var iIntervalId ;\r
37 \r
38 var oListManager = new Object() ;\r
39 \r
40 oListManager.Init = function()\r
41 {\r
42         this.Table = document.getElementById('tableFiles') ;\r
43         this.UpRow = document.getElementById('trUp') ;\r
44 \r
45         this.TableRows = new Object() ;\r
46 }\r
47 \r
48 oListManager.Clear = function()\r
49 {\r
50         // Remove all other rows available.\r
51         while ( this.Table.rows.length > 1 )\r
52                 this.Table.deleteRow(1) ;\r
53 \r
54         // Reset the TableRows collection.\r
55         this.TableRows = new Object() ;\r
56 }\r
57 \r
58 oListManager.AddItem = function( folderName, folderPath )\r
59 {\r
60         // Create the new row.\r
61         var oRow = this.Table.insertRow(-1) ;\r
62         oRow.className = 'FolderListFolder' ;\r
63 \r
64         // Build the link to view the folder.\r
65         var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;\r
66 \r
67         // Add the folder icon cell.\r
68         var oCell = oRow.insertCell(-1) ;\r
69         oCell.width = 16 ;\r
70         oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ;\r
71 \r
72         // Add the folder name cell.\r
73         oCell = oRow.insertCell(-1) ;\r
74         oCell.noWrap = true ;\r
75         oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;\r
76 \r
77         this.TableRows[ folderPath ] = oRow ;\r
78 }\r
79 \r
80 oListManager.ShowUpFolder = function( upFolderPath )\r
81 {\r
82         this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;\r
83 \r
84         if ( upFolderPath != null )\r
85         {\r
86                 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()\r
87                 {\r
88                         LoadFolders( upFolderPath ) ;\r
89                         return false ;\r
90                 }\r
91         }\r
92 }\r
93 \r
94 function CheckLoaded()\r
95 {\r
96         if ( window.top.IsLoadedActualFolder\r
97                 && window.top.IsLoadedCreateFolder\r
98                 && window.top.IsLoadedUpload\r
99                 && window.top.IsLoadedResourcesList )\r
100         {\r
101                 window.clearInterval( iIntervalId ) ;\r
102                 bIsLoaded = true ;\r
103                 OpenFolder( sActiveFolder ) ;\r
104         }\r
105 }\r
106 \r
107 function OpenFolder( folderPath )\r
108 {\r
109         sActiveFolder = folderPath ;\r
110 \r
111         if ( ! bIsLoaded )\r
112         {\r
113                 if ( ! iIntervalId )\r
114                         iIntervalId = window.setInterval( CheckLoaded, 100 ) ;\r
115                 return ;\r
116         }\r
117 \r
118         // Change the style for the select row (to show the opened folder).\r
119         for ( var sFolderPath in oListManager.TableRows )\r
120         {\r
121                 oListManager.TableRows[ sFolderPath ].className =\r
122                         ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;\r
123         }\r
124 \r
125         // Set the current folder in all frames.\r
126         window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
127         window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
128         window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;\r
129 \r
130         // Load the resources list for this folder.\r
131         window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;\r
132 }\r
133 \r
134 function LoadFolders( folderPath )\r
135 {\r
136         // Clear the folders list.\r
137         oListManager.Clear() ;\r
138 \r
139         // Get the parent folder path.\r
140         var sParentFolderPath ;\r
141         if ( folderPath != '/' )\r
142                 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;\r
143 \r
144         // Show/Hide the Up Folder.\r
145         oListManager.ShowUpFolder( sParentFolderPath ) ;\r
146 \r
147         if ( folderPath != '/' )\r
148         {\r
149                 sActiveFolder = folderPath ;\r
150                 oConnector.CurrentFolder = sParentFolderPath ;\r
151                 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;\r
152         }\r
153         else\r
154                 OpenFolder( '/' ) ;\r
155 }\r
156 \r
157 function GetFoldersCallBack( fckXml )\r
158 {\r
159         if ( oConnector.CheckError( fckXml ) != 0 )\r
160                 return ;\r
161 \r
162         // Get the current folder path.\r
163         var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;\r
164         var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;\r
165 \r
166         var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;\r
167 \r
168         for ( var i = 0 ; i < oNodes.length ; i++ )\r
169         {\r
170                 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;\r
171                 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;\r
172         }\r
173 \r
174         OpenFolder( sActiveFolder ) ;\r
175 }\r
176 \r
177 function SetResourceType( type )\r
178 {\r
179         oConnector.ResourceType = type ;\r
180         LoadFolders( '/' ) ;\r
181 }\r
182 \r
183 window.onload = function()\r
184 {\r
185         oListManager.Init() ;\r
186         LoadFolders( '/' ) ;\r
187 }\r
188                 </script>\r
189         </head>\r
190         <body class="FileArea">\r
191                 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">\r
192                         <tr id="trUp" style="DISPLAY: none">\r
193                                 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>\r
194                                 <td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>\r
195                         </tr>\r
196                 </table>\r
197         </body>\r
198 </html>\r