dolibarr 21.0.0-beta
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';
31
32?>
33<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
34<!--
35 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
36 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
37 *
38 * == BEGIN LICENSE ==
39 *
40 * Licensed under the terms of any of the following licenses at your
41 * choice:
42 *
43 * - GNU General Public License Version 2 or later (the "GPL")
44 * https://www.gnu.org/licenses/gpl.html
45 *
46 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
47 * https://www.gnu.org/licenses/lgpl.html
48 *
49 * - Mozilla Public License Version 1.1 or later (the "MPL")
50 * http://www.mozilla.org/MPL/MPL-1.1.html
51 *
52 * == END LICENSE ==
53 *
54 * This page shows the list of folders available in the parent folder
55 * of the current folder.
56-->
57<?php
58//$arrayofjs=array('js/common.js');
59//top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
60?>
61<html>
62 <head>
63 <title>Folders</title>
64 <link href="browser.css" type="text/css" rel="stylesheet">
65 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
66<?php
67print '<!-- Includes CSS for Dolibarr theme -->'."\n";
68// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
69$themepath = dol_buildpath($conf->css, 1);
70$themesubdir = '';
71if (!empty($conf->modules_parts['theme'])) { // This slow down
72 foreach ($conf->modules_parts['theme'] as $reldir) {
73 if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
74 $themepath = dol_buildpath($reldir.$conf->css, 1);
75 $themesubdir = $reldir;
76 break;
77 }
78 }
79}
80
81//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
82print '<link rel="stylesheet" type="text/css" href="'.$themepath.'">'."\n";
83?>
84 <script type="text/javascript" src="js/common.js"></script>
85 <script type="text/javascript">
86
87var sActiveFolder ;
88
89var bIsLoaded = false ;
90var iIntervalId ;
91
92var oListManager = new Object();
93
94oListManager.Init = function()
95{
96 this.Table = document.getElementById('tableFiles');
97 this.UpRow = document.getElementById('trUp');
98
99 this.TableRows = new Object();
100}
101
102oListManager.Clear = function()
103{
104 // Remove all other rows available.
105 while ( this.Table.rows.length > 1 )
106 this.Table.deleteRow(1);
107
108 // Reset the TableRows collection.
109 this.TableRows = new Object();
110}
111
112oListManager.AddItem = function( folderName, folderPath )
113{
114 // Create the new row.
115 var oRow = this.Table.insertRow(-1);
116 oRow.className = 'FolderListFolder' ;
117
118 // Build the link to view the folder.
119 var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
120
121 // Add the folder icon cell.
122 var oCell = oRow.insertCell(-1);
123 oCell.width = 16 ;
124 oCell.innerHTML = sLink + ' <\/a>' ;
125
126 // Add the folder name cell.
127 oCell = oRow.insertCell(-1);
128 oCell.noWrap = true ;
129 oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;
130
131 this.TableRows[ folderPath ] = oRow ;
132}
133
134oListManager.ShowUpFolder = function( upFolderPath )
135{
136 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
137
138 if ( upFolderPath != null )
139 {
140 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
141 {
142 LoadFolders( upFolderPath );
143 return false ;
144 }
145 }
146}
147
148function CheckLoaded()
149{
150 if ( window.top.IsLoadedActualFolder
151 && window.top.IsLoadedCreateFolder
152 && window.top.IsLoadedUpload
153 && window.top.IsLoadedResourcesList )
154 {
155 window.clearInterval( iIntervalId );
156 bIsLoaded = true ;
157 OpenFolder( sActiveFolder );
158 }
159}
160
161function OpenFolder( folderPath )
162{
163 sActiveFolder = folderPath ;
164
165 if ( ! bIsLoaded )
166 {
167 if ( ! iIntervalId )
168 iIntervalId = window.setInterval( CheckLoaded, 100 );
169 return ;
170 }
171
172 // Change the style for the select row (to show the opened folder).
173 for ( var sFolderPath in oListManager.TableRows )
174 {
175 oListManager.TableRows[ sFolderPath ].className =
176 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
177 }
178
179 // Set the current folder in all frames.
180 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
181 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
182 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
183
184 // Load the resources list for this folder.
185 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
186}
187
188function LoadFolders( folderPath )
189{
190 console.log("LoadFolders folderPath="+folderPath);
191
192 // Clear the folders list.
193 oListManager.Clear();
194
195 // Get the parent folder path.
196 var sParentFolderPath ;
197 if ( folderPath != '/' )
198 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
199
200 // Show/Hide the Up Folder.
201 oListManager.ShowUpFolder( sParentFolderPath );
202
203 if ( folderPath != '/' )
204 {
205 sActiveFolder = folderPath ;
206 oConnector.CurrentFolder = sParentFolderPath ;
207 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
208 }
209 else
210 OpenFolder( '/' );
211}
212
213function GetFoldersCallBack( fckXml )
214{
215 if ( oConnector.CheckError( fckXml ) != 0 )
216 return ;
217
218 // Get the current folder path.
219 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
220 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
221
222 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
223
224 for ( var i = 0 ; i < oNodes.length ; i++ )
225 {
226 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
227 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
228 }
229
230 OpenFolder( sActiveFolder );
231}
232
233function SetResourceType( type )
234{
235 oConnector.ResourceType = type ;
236 LoadFolders( '/' );
237}
238
239window.onload = function()
240{
241 oListManager.Init();
242 LoadFolders( '/' );
243}
244 </script>
245 </head>
246 <body class="FileArea">
247 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
248 <tr id="trUp" style="DISPLAY: none">
249 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
250 <td class="nowrap" width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
251 </tr>
252 </table>
253 </body>
254</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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:149