| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?php
- /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
- * Copyright (C) 2003-2010 Frederico Caldeira Knabben
- *
- * Source modified from part of fckeditor (http://www.fckeditor.net)
- * retrieved as GPL v2 or later
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- define('NOTOKENRENEWAL', 1); // Disables token renewal
- // Load Dolibarr environment
- require '../../../../main.inc.php';
- top_httphead();
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <!--
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2010 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * https://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * https://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * This page shows the list of folders available in the parent folder
- * of the current folder.
- -->
- <?php
- //$arrayofjs=array('js/common.js');
- //top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
- ?>
- <html>
- <head>
- <title>Folders</title>
- <link href="browser.css" type="text/css" rel="stylesheet">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <?php
- print '<!-- Includes CSS for Dolibarr theme -->'."\n";
- // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
- $themepath = dol_buildpath($conf->css, 1);
- $themesubdir = '';
- if (!empty($conf->modules_parts['theme'])) { // This slow down
- foreach ($conf->modules_parts['theme'] as $reldir) {
- if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
- $themepath = dol_buildpath($reldir.$conf->css, 1);
- $themesubdir = $reldir;
- break;
- }
- }
- }
- //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
- print '<link rel="stylesheet" type="text/css" href="'.$themepath.'">'."\n";
- ?>
- <script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript">
- var sActiveFolder ;
- var bIsLoaded = false ;
- var iIntervalId ;
- var oListManager = new Object();
- oListManager.Init = function()
- {
- this.Table = document.getElementById('tableFiles');
- this.UpRow = document.getElementById('trUp');
- this.TableRows = new Object();
- }
- oListManager.Clear = function()
- {
- // Remove all other rows available.
- while ( this.Table.rows.length > 1 )
- this.Table.deleteRow(1);
- // Reset the TableRows collection.
- this.TableRows = new Object();
- }
- oListManager.AddItem = function( folderName, folderPath )
- {
- // Create the new row.
- var oRow = this.Table.insertRow(-1);
- oRow.className = 'FolderListFolder' ;
- // Build the link to view the folder.
- var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
- // Add the folder icon cell.
- var oCell = oRow.insertCell(-1);
- oCell.width = 16 ;
- oCell.innerHTML = sLink + ' <\/a>' ;
- // Add the folder name cell.
- oCell = oRow.insertCell(-1);
- oCell.noWrap = true ;
- oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
- this.TableRows[ folderPath ] = oRow ;
- }
- oListManager.ShowUpFolder = function( upFolderPath )
- {
- this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
- if ( upFolderPath != null )
- {
- document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
- {
- LoadFolders( upFolderPath );
- return false ;
- }
- }
- }
- function CheckLoaded()
- {
- if ( window.top.IsLoadedActualFolder
- && window.top.IsLoadedCreateFolder
- && window.top.IsLoadedUpload
- && window.top.IsLoadedResourcesList )
- {
- window.clearInterval( iIntervalId );
- bIsLoaded = true ;
- OpenFolder( sActiveFolder );
- }
- }
- function OpenFolder( folderPath )
- {
- sActiveFolder = folderPath ;
- if ( ! bIsLoaded )
- {
- if ( ! iIntervalId )
- iIntervalId = window.setInterval( CheckLoaded, 100 );
- return ;
- }
- // Change the style for the select row (to show the opened folder).
- for ( var sFolderPath in oListManager.TableRows )
- {
- oListManager.TableRows[ sFolderPath ].className =
- ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
- }
- // Set the current folder in all frames.
- window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
- window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
- window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
- // Load the resources list for this folder.
- window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
- }
- function LoadFolders( folderPath )
- {
- // Clear the folders list.
- oListManager.Clear();
- // Get the parent folder path.
- var sParentFolderPath ;
- if ( folderPath != '/' )
- sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
- // Show/Hide the Up Folder.
- oListManager.ShowUpFolder( sParentFolderPath );
- if ( folderPath != '/' )
- {
- sActiveFolder = folderPath ;
- oConnector.CurrentFolder = sParentFolderPath ;
- oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
- }
- else
- OpenFolder( '/' );
- }
- function GetFoldersCallBack( fckXml )
- {
- if ( oConnector.CheckError( fckXml ) != 0 )
- return ;
- // Get the current folder path.
- var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
- var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
- var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
- for ( var i = 0 ; i < oNodes.length ; i++ )
- {
- var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
- oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
- }
- OpenFolder( sActiveFolder );
- }
- function SetResourceType( type )
- {
- oConnector.ResourceType = type ;
- LoadFolders( '/' );
- }
- window.onload = function()
- {
- oListManager.Init();
- LoadFolders( '/' );
- }
- </script>
- </head>
- <body class="FileArea">
- <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
- <tr id="trUp" style="DISPLAY: none">
- <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
- <td class="nowrap" width="100%"> <a id="linkUp" href="#">..</a></td>
- </tr>
- </table>
- </body>
- </html>
|