dolibarr 18.0.6
frmfolders.php
1<?php
2/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
4 *
5 * Source modified from part of fckeditor (http://www.fckeditor.net)
6 * retrieved as GPL v2 or later
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22define('NOTOKENRENEWAL', 1); // Disables token renewal
23
24// Load Dolibarr environment
25require '../../../../main.inc.php';
26
28
29?>
30<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
31<!--
32 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
33 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
34 *
35 * == BEGIN LICENSE ==
36 *
37 * Licensed under the terms of any of the following licenses at your
38 * choice:
39 *
40 * - GNU General Public License Version 2 or later (the "GPL")
41 * https://www.gnu.org/licenses/gpl.html
42 *
43 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
44 * https://www.gnu.org/licenses/lgpl.html
45 *
46 * - Mozilla Public License Version 1.1 or later (the "MPL")
47 * http://www.mozilla.org/MPL/MPL-1.1.html
48 *
49 * == END LICENSE ==
50 *
51 * This page shows the list of folders available in the parent folder
52 * of the current folder.
53-->
54<?php
55//$arrayofjs=array('js/common.js');
56//top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
57?>
58<html>
59 <head>
60 <title>Folders</title>
61 <link href="browser.css" type="text/css" rel="stylesheet">
62 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
63<?php
64print '<!-- Includes CSS for Dolibarr theme -->'."\n";
65// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
66$themepath = dol_buildpath($conf->css, 1);
67$themesubdir = '';
68if (!empty($conf->modules_parts['theme'])) { // This slow down
69 foreach ($conf->modules_parts['theme'] as $reldir) {
70 if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
71 $themepath = dol_buildpath($reldir.$conf->css, 1);
72 $themesubdir = $reldir;
73 break;
74 }
75 }
76}
77
78//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
79print '<link rel="stylesheet" type="text/css" href="'.$themepath.'">'."\n";
80?>
81 <script type="text/javascript" src="js/common.js"></script>
82 <script type="text/javascript">
83
84var sActiveFolder ;
85
86var bIsLoaded = false ;
87var iIntervalId ;
88
89var oListManager = new Object();
90
91oListManager.Init = function()
92{
93 this.Table = document.getElementById('tableFiles');
94 this.UpRow = document.getElementById('trUp');
95
96 this.TableRows = new Object();
97}
98
99oListManager.Clear = function()
100{
101 // Remove all other rows available.
102 while ( this.Table.rows.length > 1 )
103 this.Table.deleteRow(1);
104
105 // Reset the TableRows collection.
106 this.TableRows = new Object();
107}
108
109oListManager.AddItem = function( folderName, folderPath )
110{
111 // Create the new row.
112 var oRow = this.Table.insertRow(-1);
113 oRow.className = 'FolderListFolder' ;
114
115 // Build the link to view the folder.
116 var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
117
118 // Add the folder icon cell.
119 var oCell = oRow.insertCell(-1);
120 oCell.width = 16 ;
121 oCell.innerHTML = sLink + ' <\/a>' ;
122
123 // Add the folder name cell.
124 oCell = oRow.insertCell(-1);
125 oCell.noWrap = true ;
126 oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;
127
128 this.TableRows[ folderPath ] = oRow ;
129}
130
131oListManager.ShowUpFolder = function( upFolderPath )
132{
133 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
134
135 if ( upFolderPath != null )
136 {
137 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
138 {
139 LoadFolders( upFolderPath );
140 return false ;
141 }
142 }
143}
144
145function CheckLoaded()
146{
147 if ( window.top.IsLoadedActualFolder
148 && window.top.IsLoadedCreateFolder
149 && window.top.IsLoadedUpload
150 && window.top.IsLoadedResourcesList )
151 {
152 window.clearInterval( iIntervalId );
153 bIsLoaded = true ;
154 OpenFolder( sActiveFolder );
155 }
156}
157
158function OpenFolder( folderPath )
159{
160 sActiveFolder = folderPath ;
161
162 if ( ! bIsLoaded )
163 {
164 if ( ! iIntervalId )
165 iIntervalId = window.setInterval( CheckLoaded, 100 );
166 return ;
167 }
168
169 // Change the style for the select row (to show the opened folder).
170 for ( var sFolderPath in oListManager.TableRows )
171 {
172 oListManager.TableRows[ sFolderPath ].className =
173 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
174 }
175
176 // Set the current folder in all frames.
177 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
178 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
179 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
180
181 // Load the resources list for this folder.
182 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
183}
184
185function LoadFolders( folderPath )
186{
187 // Clear the folders list.
188 oListManager.Clear();
189
190 // Get the parent folder path.
191 var sParentFolderPath ;
192 if ( folderPath != '/' )
193 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
194
195 // Show/Hide the Up Folder.
196 oListManager.ShowUpFolder( sParentFolderPath );
197
198 if ( folderPath != '/' )
199 {
200 sActiveFolder = folderPath ;
201 oConnector.CurrentFolder = sParentFolderPath ;
202 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
203 }
204 else
205 OpenFolder( '/' );
206}
207
208function GetFoldersCallBack( fckXml )
209{
210 if ( oConnector.CheckError( fckXml ) != 0 )
211 return ;
212
213 // Get the current folder path.
214 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
215 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
216
217 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
218
219 for ( var i = 0 ; i < oNodes.length ; i++ )
220 {
221 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
222 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
223 }
224
225 OpenFolder( sActiveFolder );
226}
227
228function SetResourceType( type )
229{
230 oConnector.ResourceType = type ;
231 LoadFolders( '/' );
232}
233
234window.onload = function()
235{
236 oListManager.Init();
237 LoadFolders( '/' );
238}
239 </script>
240 </head>
241 <body class="FileArea">
242 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
243 <tr id="trUp" style="DISPLAY: none">
244 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
245 <td class="nowrap" width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
246 </tr>
247 </table>
248 </body>
249</html>
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120