22 define(
'NOTOKENRENEWAL', 1);
24 require
'../../../../main.inc.php';
26 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
28 * FCKeditor - The text editor
for Internet - http:
29 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
33 * Licensed under the terms of any of the following licenses at your
36 * - GNU General Public License Version 2 or later (the
"GPL")
39 * - GNU Lesser General Public License Version 2.1 or later (the
"LGPL")
42 * - Mozilla Public License Version 1.1 or later (the
"MPL")
47 * This page shows all resources available in a folder in the File Browser.
51 <title>Resources</title>
52 <link href=
"browser.css" type=
"text/css" rel=
"stylesheet">
53 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
54 <script
type=
"text/javascript" src=
"js/common.js"></script>
55 <script
type=
"text/javascript">
57 var oListManager =
new Object();
59 oListManager.Clear =
function()
61 document.body.innerHTML =
'' ;
64 function ProtectPath(path)
66 path = path.replace( /\\/g,
'\\\\');
67 path = path.replace( /
'/g, '\\\
'');
71 oListManager.GetFolderRowHtml =
function( folderName, folderPath )
74 var sLink =
'<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath) +
'\');
return false;
">' ;
79 '<img alt="" src="images/Folder.gif
" width="16
" height="16
" border="0
"><\/a>' +
80 '<\/td><td class="nowrap
" colspan="2
"> ' +
87 // Note: fileUrl must be already "URL encoded
"
88 oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
90 // Build the link to view the folder.
91 var sLink = '<a href="#
" onclick="OpenFile(\
'' + ProtectPath(fileUrl) +
'\');
return false;
">' ;
94 var sIcon = oIcons.GetIcon( fileName );
99 '<img alt="" src="images/icons/
' + sIcon + '.gif
" width="16
" height="16
" border="0
"><\/a>' +
104 '<\/td><td class="nowrap right
"> ' +
110 function OpenFolder( folderPath )
112 // Load the resources list for this folder.
113 window.parent.frames['frmFolders'].LoadFolders( folderPath );
116 function GetUrlParam( paramName )
118 var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
119 var oMatch = oRegex.exec( window.top.location.search );
121 if ( oMatch && oMatch.length > 1 )
122 return decodeURIComponent( oMatch[1] );
127 // Note fileUrl must be already "URL encoded
"
128 function OpenFile( fileUrl )
130 funcNum = GetUrlParam('CKEditorFuncNum');
131 //window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
132 window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl.replace( '#', '%23' ));
136 window.top.opener.focus();
139 function LoadResources( resourceType, folderPath )
141 oListManager.Clear();
142 oConnector.ResourceType = resourceType ;
143 oConnector.CurrentFolder = folderPath ;
144 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
149 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
152 function GetFoldersAndFilesCallBack( fckXml )
154 if ( oConnector.CheckError( fckXml ) != 0 )
157 // Get the current folder path.
158 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
159 if ( oFolderNode == null )
161 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
164 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
165 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
167 // var dTimer = new Date();
169 var oHtml = new StringBuilder( '<table id="tableFiles
" cellspacing="1
" cellpadding="0
" width="100%
" border="0
">' );
173 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
174 for ( var i = 0 ; i < oNodes.length ; i++ )
176 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
177 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/
" ) );
181 oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
182 for ( var j = 0 ; j < oNodes.length ; j++ )
184 var oNode = oNodes[j] ;
185 var sFileName = oNode.attributes.getNamedItem('name').value ;
186 var sFileSize = oNode.attributes.getNamedItem('size').value ;
188 // Get the optional "url
" attribute. If not available, build the url.
189 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
190 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
192 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
195 oHtml.Append( '<\/table>' );
197 document.body.innerHTML = oHtml.ToString();
199 // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
203 window.onload = function()
205 window.top.IsLoadedResourcesList = true ;
209 <body class="FileArea
">
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type