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 console.log("OpenFolder folderPath=
"+folderPath);
136 // Load the resources list for this folder.
137 window.parent.frames['frmFolders'].LoadFolders( folderPath );
140function GetUrlParam( paramName )
142 var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
143 var oMatch = oRegex.exec( window.top.location.search );
145 if ( oMatch && oMatch.length > 1 )
146 return decodeURIComponent( oMatch[1] );
151// Note fileUrl must be already "URL encoded
"
152function OpenFile( fileUrl )
154 funcNum = GetUrlParam('CKEditorFuncNum');
155 //window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
156 window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl.replace( '#', '%23' ));
160 window.top.opener.focus();
163function LoadResources( resourceType, folderPath )
165 oListManager.Clear();
166 oConnector.ResourceType = resourceType ;
167 oConnector.CurrentFolder = folderPath ;
168 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
173 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
176function GetFoldersAndFilesCallBack( fckXml )
178 if ( oConnector.CheckError( fckXml ) != 0 )
181 // Get the current folder path.
182 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
183 if ( oFolderNode == null )
185 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
188 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
189 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
191// var dTimer = new Date();
193 var oHtml = new StringBuilder( '<table id="tableFiles
" cellspacing="1
" cellpadding="0
" width="100%
" border="0
">' );
197 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
198 for ( var i = 0 ; i < oNodes.length ; i++ )
200 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
201 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/
" ) );
205 oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
206 for ( var j = 0 ; j < oNodes.length ; j++ )
208 var oNode = oNodes[j] ;
209 var sFileName = oNode.attributes.getNamedItem('name').value ;
210 var sFileSize = oNode.attributes.getNamedItem('size').value ;
212 // Get the optional "url
" attribute. If not available, build the url.
213 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
214 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
216 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
219 oHtml.Append( '<\/table>' );
221 document.body.innerHTML = oHtml.ToString();
223// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
227window.onload = function()
229 window.top.IsLoadedResourcesList = true ;
233<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