22 define(
'NOTOKENRENEWAL', 1);
24 require
'../../../../main.inc.php';
27 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
29 * FCKeditor - The text editor
for Internet - http:
30 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
34 * Licensed under the terms of any of the following licenses at your
37 * - GNU General Public License Version 2 or later (the
"GPL")
40 * - GNU Lesser General Public License Version 2.1 or later (the
"LGPL")
43 * - Mozilla Public License Version 1.1 or later (the
"MPL")
48 * This page shows the list of folders available in the parent folder
49 * of the current folder.
57 <title>Folders</title>
58 <link href=
"browser.css" type=
"text/css" rel=
"stylesheet">
59 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
61 print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
65 if (!empty($conf->modules_parts[
'theme'])) {
66 foreach ($conf->modules_parts[
'theme'] as $reldir) {
69 $themesubdir = $reldir;
76 print
'<link rel="stylesheet" type="text/css" href="'.$themepath.
'">'.
"\n";
78 <script
type=
"text/javascript" src=
"js/common.js"></script>
79 <script
type=
"text/javascript">
83 var bIsLoaded = false ;
86 var oListManager =
new Object();
88 oListManager.Init =
function()
90 this.Table = document.getElementById(
'tableFiles');
91 this.UpRow = document.getElementById(
'trUp');
93 this.TableRows =
new Object();
96 oListManager.Clear =
function()
99 while ( this.Table.rows.length > 1 )
100 this.Table.deleteRow(1);
103 this.TableRows =
new Object();
106 oListManager.AddItem =
function( folderName, folderPath )
109 var oRow = this.Table.insertRow(-1);
110 oRow.className =
'FolderListFolder' ;
113 var sLink =
'<a href="#" onclick="OpenFolder(\'' + folderPath +
'\');
return false;
">' ;
115 // Add the folder icon cell.
116 var oCell = oRow.insertCell(-1);
118 oCell.innerHTML = sLink + ' <\/a>' ;
120 // Add the folder name cell.
121 oCell = oRow.insertCell(-1);
122 oCell.noWrap = true ;
123 oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
125 this.TableRows[ folderPath ] = oRow ;
128 oListManager.ShowUpFolder = function( upFolderPath )
130 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
132 if ( upFolderPath != null )
134 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
136 LoadFolders( upFolderPath );
142 function CheckLoaded()
144 if ( window.top.IsLoadedActualFolder
145 && window.top.IsLoadedCreateFolder
146 && window.top.IsLoadedUpload
147 && window.top.IsLoadedResourcesList )
149 window.clearInterval( iIntervalId );
151 OpenFolder( sActiveFolder );
155 function OpenFolder( folderPath )
157 sActiveFolder = folderPath ;
162 iIntervalId = window.setInterval( CheckLoaded, 100 );
166 // Change the style for the select row (to show the opened folder).
167 for ( var sFolderPath in oListManager.TableRows )
169 oListManager.TableRows[ sFolderPath ].className =
170 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
173 // Set the current folder in all frames.
174 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
175 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
176 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
178 // Load the resources list for this folder.
179 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
182 function LoadFolders( folderPath )
184 // Clear the folders list.
185 oListManager.Clear();
187 // Get the parent folder path.
188 var sParentFolderPath ;
189 if ( folderPath != '/' )
190 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
192 // Show/Hide the Up Folder.
193 oListManager.ShowUpFolder( sParentFolderPath );
195 if ( folderPath != '/' )
197 sActiveFolder = folderPath ;
198 oConnector.CurrentFolder = sParentFolderPath ;
199 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
205 function GetFoldersCallBack( fckXml )
207 if ( oConnector.CheckError( fckXml ) != 0 )
210 // Get the current folder path.
211 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
212 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
214 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
216 for ( var i = 0 ; i < oNodes.length ; i++ )
218 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
219 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
222 OpenFolder( sActiveFolder );
225 function SetResourceType( type )
227 oConnector.ResourceType = type ;
231 window.onload = function()
238 <body class="FileArea
">
239 <table id="tableFiles
" cellSpacing="0
" cellPadding="0
" width="100%
" border="0
">
240 <tr id="trUp
" style="DISPLAY: none
">
241 <td width="16
"><a id="linkUpIcon
" href="#
"><img alt="" src="images/FolderUp.gif
" width="16
" height="16
" border="0
"></a></td>
242 <td class="nowrap
" width="100%
"> <a id="linkUp
" href="#
">..</a></td>