22define(
'NOTOKENRENEWAL', 1);
25require
'../../../../main.inc.php';
30<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
32 * FCKeditor - The text editor
for Internet - http:
33 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
37 * Licensed under the terms of any of the following licenses at your
40 * - GNU General Public License Version 2 or later (the
"GPL")
43 * - GNU Lesser General Public License Version 2.1 or later (the
"LGPL")
46 * - Mozilla Public License Version 1.1 or later (the
"MPL")
51 * This page shows all resources available in a folder in the File Browser.
55 <title>Resources</title>
56 <link href=
"browser.css" type=
"text/css" rel=
"stylesheet">
58print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
62if (!empty($conf->modules_parts[
'theme'])) {
63 foreach ($conf->modules_parts[
'theme'] as $reldir) {
66 $themesubdir = $reldir;
73print
'<link rel="stylesheet" type="text/css" href="'.$themepath.
'">'.
"\n";
75 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
76 <script
type=
"text/javascript" src=
"js/common.js"></script>
77 <script
type=
"text/javascript">
79var oListManager =
new Object();
81oListManager.Clear =
function()
83 document.body.innerHTML =
'' ;
86function ProtectPath(path)
88 path = path.replace( /\\/g,
'\\\\');
89 path = path.replace( /
'/g, '\\\
'');
93oListManager.GetFolderRowHtml =
function( folderName, folderPath )
96 var sLink =
'<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath) +
'\');
return false;
">' ;
101 '<img alt="" src="images/Folder.gif
" width="16
" height="16
" border="0
"><\/a>' +
102 '<\/td><td class="nowrap
" colspan="2
"> ' +
109// Note: fileUrl must be already "URL encoded
"
110oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
112 // Build the link to view the folder.
113 var sLink = '<a href="#
" onclick="OpenFile(\
'' + ProtectPath(fileUrl) +
'\');
return false;
">' ;
115 // Get the file icon.
116 var sIcon = oIcons.GetIcon( fileName );
121 '<img alt="" src="images/icons/
' + sIcon + '.gif
" width="16
" height="16
" border="0
"><\/a>' +
126 '<\/td><td class="nowrap right
"> ' +
132function OpenFolder( folderPath )
134 // Load the resources list for this folder.
135 window.parent.frames['frmFolders'].LoadFolders( folderPath );
138function GetUrlParam( paramName )
140 var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
141 var oMatch = oRegex.exec( window.top.location.search );
143 if ( oMatch && oMatch.length > 1 )
144 return decodeURIComponent( oMatch[1] );
149// Note fileUrl must be already "URL encoded
"
150function OpenFile( fileUrl )
152 funcNum = GetUrlParam('CKEditorFuncNum');
153 //window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
154 window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl.replace( '#', '%23' ));
158 window.top.opener.focus();
161function LoadResources( resourceType, folderPath )
163 oListManager.Clear();
164 oConnector.ResourceType = resourceType ;
165 oConnector.CurrentFolder = folderPath ;
166 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
171 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
174function GetFoldersAndFilesCallBack( fckXml )
176 if ( oConnector.CheckError( fckXml ) != 0 )
179 // Get the current folder path.
180 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
181 if ( oFolderNode == null )
183 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
186 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
187 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
189// var dTimer = new Date();
191 var oHtml = new StringBuilder( '<table id="tableFiles
" cellspacing="1
" cellpadding="0
" width="100%
" border="0
">' );
195 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
196 for ( var i = 0 ; i < oNodes.length ; i++ )
198 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
199 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/
" ) );
203 oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
204 for ( var j = 0 ; j < oNodes.length ; j++ )
206 var oNode = oNodes[j] ;
207 var sFileName = oNode.attributes.getNamedItem('name').value ;
208 var sFileSize = oNode.attributes.getNamedItem('size').value ;
210 // Get the optional "url
" attribute. If not available, build the url.
211 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
212 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
214 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
217 oHtml.Append( '<\/table>' );
219 document.body.innerHTML = oHtml.ToString();
221// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
225window.onload = function()
227 window.top.IsLoadedResourcesList = true ;
231<body class="FileArea
">
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