FCKeditor 2.6.6
[freeside.git] / httemplate / elements / fckeditor / editor / filemanager / browser / default / frmresourceslist.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 all resources available in a folder in the File Browser.\r
23 -->\r
24 <html>\r
25 <head>\r
26         <title>Resources</title>\r
27         <link href="browser.css" type="text/css" rel="stylesheet">\r
28         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
29         <script type="text/javascript" src="js/common.js"></script>\r
30         <script type="text/javascript">\r
31 \r
32 var oListManager = new Object() ;\r
33 \r
34 oListManager.Clear = function()\r
35 {\r
36         document.body.innerHTML = '' ;\r
37 }\r
38 \r
39 function ProtectPath(path)\r
40 {\r
41         path = path.replace( /\\/g, '\\\\') ;\r
42         path = path.replace( /'/g, '\\\'') ;\r
43         return path ;\r
44 }\r
45 \r
46 oListManager.GetFolderRowHtml = function( folderName, folderPath )\r
47 {\r
48         // Build the link to view the folder.\r
49         var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;\r
50 \r
51         return '<tr>' +\r
52                         '<td width="16">' +\r
53                                 sLink +\r
54                                 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +\r
55                         '<\/td><td nowrap colspan="2">&nbsp;' +\r
56                                 sLink +\r
57                                 folderName +\r
58                                 '<\/a>' +\r
59                 '<\/td><\/tr>' ;\r
60 }\r
61 \r
62 oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )\r
63 {\r
64         // Build the link to view the folder.\r
65         var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;\r
66 \r
67         // Get the file icon.\r
68         var sIcon = oIcons.GetIcon( fileName ) ;\r
69 \r
70         return '<tr>' +\r
71                         '<td width="16">' +\r
72                                 sLink +\r
73                                 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +\r
74                         '<\/td><td>&nbsp;' +\r
75                                 sLink +\r
76                                 fileName +\r
77                                 '<\/a>' +\r
78                         '<\/td><td align="right" nowrap>&nbsp;' +\r
79                                 fileSize +\r
80                                 ' KB' +\r
81                 '<\/td><\/tr>' ;\r
82 }\r
83 \r
84 function OpenFolder( folderPath )\r
85 {\r
86         // Load the resources list for this folder.\r
87         window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;\r
88 }\r
89 \r
90 function OpenFile( fileUrl )\r
91 {\r
92         window.top.opener.SetUrl( fileUrl ) ;\r
93         window.top.close() ;\r
94         window.top.opener.focus() ;\r
95 }\r
96 \r
97 function LoadResources( resourceType, folderPath )\r
98 {\r
99         oListManager.Clear() ;\r
100         oConnector.ResourceType = resourceType ;\r
101         oConnector.CurrentFolder = folderPath ;\r
102         oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;\r
103 }\r
104 \r
105 function Refresh()\r
106 {\r
107         LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;\r
108 }\r
109 \r
110 function GetFoldersAndFilesCallBack( fckXml )\r
111 {\r
112         if ( oConnector.CheckError( fckXml ) != 0 )\r
113                 return ;\r
114 \r
115         // Get the current folder path.\r
116         var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;\r
117         if ( oFolderNode == null )\r
118         {\r
119                 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;\r
120                 return ;\r
121         }\r
122         var sCurrentFolderPath  = oFolderNode.attributes.getNamedItem('path').value ;\r
123         var sCurrentFolderUrl   = oFolderNode.attributes.getNamedItem('url').value ;\r
124 \r
125 //      var dTimer = new Date() ;\r
126 \r
127         var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;\r
128 \r
129         // Add the Folders.\r
130         var oNodes ;\r
131         oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;\r
132         for ( var i = 0 ; i < oNodes.length ; i++ )\r
133         {\r
134                 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;\r
135                 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;\r
136         }\r
137 \r
138         // Add the Files.\r
139         oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;\r
140         for ( var j = 0 ; j < oNodes.length ; j++ )\r
141         {\r
142                 var oNode = oNodes[j] ;\r
143                 var sFileName = oNode.attributes.getNamedItem('name').value ;\r
144                 var sFileSize = oNode.attributes.getNamedItem('size').value ;\r
145 \r
146                 // Get the optional "url" attribute. If not available, build the url.\r
147                 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;\r
148                 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ;\r
149 \r
150                 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;\r
151         }\r
152 \r
153         oHtml.Append( '<\/table>' ) ;\r
154 \r
155         document.body.innerHTML = oHtml.ToString() ;\r
156 \r
157 //      window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;\r
158 \r
159 }\r
160 \r
161 window.onload = function()\r
162 {\r
163         window.top.IsLoadedResourcesList = true ;\r
164 }\r
165         </script>\r
166 </head>\r
167 <body class="FileArea">\r
168 </body>\r
169 </html>\r