22define(
'NOTOKENRENEWAL', 1);
25require
'../../../../main.inc.php';
33<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
35 * FCKeditor - The text editor
for Internet - http:
36 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
40 * Licensed under the terms of any of the following licenses at your
43 * - GNU General Public License Version 2 or later (the
"GPL")
46 * - GNU Lesser General Public License Version 2.1 or later (the
"LGPL")
49 * - Mozilla Public License Version 1.1 or later (the
"MPL")
54 * This page shows all resources available in a folder in the File Browser.
58 <title>Resources</title>
59 <link href=
"browser.css" type=
"text/css" rel=
"stylesheet">
61print
'<!-- Includes CSS for Dolibarr theme -->'.
"\n";
65if (!empty(
$conf->modules_parts[
'theme'])) {
66 foreach (
$conf->modules_parts[
'theme'] as $reldir) {
69 $themesubdir = $reldir;
76print
'<link rel="stylesheet" type="text/css" href="'.$themepath.
'">'.
"\n";
78 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
79 <script
type=
"text/javascript" src=
"js/common.js"></script>
80 <script
type=
"text/javascript">
82var oListManager =
new Object();
84oListManager.Clear =
function()
86 document.body.innerHTML =
'' ;
89function ProtectPath(path)
91 path = path.replace( /\\/g,
'\\\\');
92 path = path.replace( /
'/g, '\\\
'');
96oListManager.GetFolderRowHtml =
function( folderName, folderPath )
99 var sLink =
'<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath) +
'\');
return false;
">' ;
104 '<img alt="" src="images/Folder.gif
" width="16
" height="16
" border="0
"><\/a>' +
105 '<\/td><td class="nowrap
" colspan="2
"> ' +
112// Note: fileUrl must be already "URL encoded
"
113oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
115 // Build the link to view the folder.
116 var sLink = '<a href="#
" onclick="OpenFile(\
'' + ProtectPath(fileUrl) +
'\');
return false;
">' ;
118 // Get the file icon.
119 var sIcon = oIcons.GetIcon( fileName );
124 '<img alt="" src="images/icons/
' + sIcon + '.gif
" width="16
" height="16
" border="0
"><\/a>' +
129 '<\/td><td class="nowrap right
"> ' +
135function OpenFolder( folderPath )
137 console.log("OpenFolder folderPath=
"+folderPath);
139 // Load the resources list for this folder.
140 window.parent.frames['frmFolders'].LoadFolders( folderPath );
143function GetUrlParam( paramName )
145 var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
146 var oMatch = oRegex.exec( window.top.location.search );
148 if ( oMatch && oMatch.length > 1 )
149 return decodeURIComponent( oMatch[1] );
154// Note fileUrl must be already "URL encoded
"
155function OpenFile( fileUrl )
157 funcNum = GetUrlParam('CKEditorFuncNum');
158 //window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
159 window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl.replace( '#', '%23' ));
163 window.top.opener.focus();
166function LoadResources( resourceType, folderPath )
168 oListManager.Clear();
169 oConnector.ResourceType = resourceType ;
170 oConnector.CurrentFolder = folderPath ;
171 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
176 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
179function GetFoldersAndFilesCallBack( fckXml )
181 if ( oConnector.CheckError( fckXml ) != 0 )
184 // Get the current folder path.
185 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
186 if ( oFolderNode == null )
188 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
191 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
192 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
194// var dTimer = new Date();
196 var oHtml = new StringBuilder( '<table id="tableFiles
" cellspacing="1
" cellpadding="0
" width="100%
" border="0
">' );
200 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
201 for ( var i = 0 ; i < oNodes.length ; i++ )
203 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
204 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/
" ) );
208 oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
209 for ( var j = 0 ; j < oNodes.length ; j++ )
211 var oNode = oNodes[j] ;
212 var sFileName = oNode.attributes.getNamedItem('name').value ;
213 var sFileSize = oNode.attributes.getNamedItem('size').value ;
215 // Get the optional "url
" attribute. If not available, build the url.
216 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
217 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
219 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
222 oHtml.Append( '<\/table>' );
224 document.body.innerHTML = oHtml.ToString();
226// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
230window.onload = function()
232 window.top.IsLoadedResourcesList = true ;
236<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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type