1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * This page compose the File Browser dialog frameset.
23-->
24<html>
25	<head>
26		<title>FCKeditor - Resources Browser</title>
27		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
28		<link href="browser.css" type="text/css" rel="stylesheet">
29		<script type="text/javascript" src="js/fckxml.js"></script>
30		<script type="text/javascript" src="js/language.js"></script>
31		<script type="text/javascript" src="js/safeFN_class.js"></script>
32		<script type="text/javascript">
33window.onbeforeunload = function() { };
34var CurrentDWikiUser = opener.oDokuWiki_FCKEditorInstance.dwiki_user; // use this variable to pass into frame (frmupload.html)
35var CurrentDWikiClient = opener.oDokuWiki_FCKEditorInstance.dwiki_client; // use this variable to pass into frame (frmupload.html)
36var isLocalDwikiBrowser = opener.oDokuWiki_FCKEditorInstance.isLocalDwikiBrowser ? true : false;
37var CreateDwikiFolder = opener.oDokuWiki_FCKEditorInstance.dwiki_create_folder;  // use this variable to pass into frame (frmupload.html)
38var DwikiFNencode = opener.oDokuWiki_FCKEditorInstance.dwiki_fnencode;
39var isDwikiUrlExtern = opener.oDokuWiki_FCKEditorInstance.isUrlExtern ? true: false;
40var DwikiImageUploadAllowedExtensions = opener.oDokuWiki_FCKEditorInstance.imageUploadAllowedExtensions;
41var isDwikiMediaFile = opener.oDokuWiki_FCKEditorInstance.isDwikiMediaFile;
42var isDwikiImage = opener.oDokuWiki_FCKEditorInstance.isDwikiImage;
43var fbsz_increment =opener.oDokuWiki_FCKEditorInstance.fbsz_increment;
44// Automatically detect the correct document.domain (#1919).
45(function()
46{
47	var d = document.domain ;
48
49	while ( true )
50	{
51		// Test if we can access a parent property.
52		try
53		{
54			var test = window.opener.document.domain ;
55			break ;
56		}
57		catch( e )
58		{}
59
60		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
61		d = d.replace( /.*?(?:\.|$)/, '' ) ;
62
63		if ( d.length == 0 )
64			break ;		// It was not able to detect the domain.
65
66		try
67		{
68			document.domain = d ;
69		}
70		catch (e)
71		{
72			break ;
73		}
74	}
75})() ;
76
77
78window.onload = function()
79{
80   window.top.IsLoadedCreateFolder = true ;
81  setupLanguage();
82
83   if(CurrentDWikiUser == 'visitor' || isLocalDwikiBrowser || !CurrentDWikiUser) {
84     document.getElementById("btn__create_folder").disabled = true;
85     document.getElementById("create_folder").innerHTML = "";
86   }
87  else document.getElementById("create_folder").style.display='block';
88
89   if(CreateDwikiFolder == 'n') {
90        document.getElementById('create_folder').style.display = 'none';
91}
92
93 if(navigator.userAgent.match(/macintosh/i)) {
94       document.getElementById('is_mac').innerHTML = 'Cmd';
95 }
96  if(navigator.userAgent.indexOf('MSIE') != -1 ||  navigator.userAgent.indexOf('Trident') != -1) {
97      document.getElementById('adustfbbuttons').style.display='none';
98  }
99  if(fbsz_increment > 0) {
100      var isIE = navigator.userAgent.indexOf('MSIE') >= 0 ? true : false;
101      var fbl = document.getElementById("frmResourcesList");
102      var frmfolders = document.getElementById("frmFolders");
103      fbl['height']  = 400 + (400*(fbsz_increment/100));
104      frmfolders['height'] = 490 + (490*(fbsz_increment/100));
105      if(!isIE) {
106          var fbaf = document.getElementById("frmActualFolder");
107          var width = 750 + (750*(fbsz_increment/100));
108          fbl['width']  = width;
109          fbaf['width']  = width;
110          frmfolders['width'] = 180 + (180*(fbsz_increment/100));
111          var fbmatter = document.getElementById("bottom_matter");
112          fbmatter.style.width = width;
113       }
114      var whichsz = document.getElementById("adjfbsz" + fbsz_increment);
115      whichsz.checked=true;
116
117  }
118}
119function GetUrlParam( paramName )
120{
121	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
122	var oMatch = oRegex.exec( window.top.location.search ) ;
123
124	if ( oMatch && oMatch.length > 1 ) {
125       // alert(paramName + ' ' + decodeURIComponent( oMatch[1] ) );
126		return decodeURIComponent( oMatch[1] ) ;
127      // return dwikiUTF8_decodeFN( oMatch[1],DwikiFNencode);
128	}
129	else
130		return '' ;
131}
132
133var oConnector = new Object() ;
134oConnector.CurrentFolder	= '/' ;
135
136var sConnUrl = GetUrlParam( 'Connector' ) ;
137
138// Gecko has some problems when using relative URLs (not starting with slash).
139if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
140	sConnUrl = window.location.href.replace( /browser.html.*$/, '' ) + sConnUrl ;
141
142oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ;
143
144var sServerPath = GetUrlParam( 'ServerPath' ) ;
145
146if ( sServerPath.length > 0 )
147	oConnector.ConnectorUrl += 'ServerPath=' + dwikiUTF8_encodeFN(sServerPath, 'url') + '&' ;
148
149oConnector.ResourceType		= GetUrlParam( 'Type' ) ;
150oConnector.ShowAllTypes		= ( oConnector.ResourceType.length == 0 ) ;
151
152if ( oConnector.ShowAllTypes )
153	oConnector.ResourceType = 'File' ;
154
155oConnector.SendCommand = function( command, params, callBackFunction )
156{
157   /* requires safe_ascii */
158
159	var sUrl = this.ConnectorUrl + 'Command=' + command ;
160	sUrl += '&Type=' + this.ResourceType ;
161	sUrl += '&CurrentFolder=' + dwikiUTF8_encodeFN(this.CurrentFolder, DwikiFNencode);
162
163//	sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
164
165	if ( params ) sUrl += '&' + params ;
166
167    // opener takes its values from onload of helper.php
168   // alert('opener='+opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups);
169
170 //   sUrl += '&DWFCK_Browser=local'; // this opens the local browser
171
172    if(isLocalDwikiBrowser) {
173        sUrl += '&DWFCK_Browser=local';
174   }
175    if(CurrentDWikiClient) {
176        sUrl += '&DWFCK_Client=' + CurrentDWikiClient;
177   }
178    if(CurrentDWikiClient) {
179        sUrl += '&DWFCK_usergrps=' + opener.oDokuWiki_FCKEditorInstance.dwiki_usergroups;
180   }
181
182	// Add a random salt to avoid getting a cached version of the command execution
183	sUrl += '&uuid=' + new Date().getTime() ;
184
185	var oXML = new FCKXml() ;
186
187	if ( callBackFunction )
188		oXML.LoadUrl( sUrl, callBackFunction ) ;	// Asynchronous load.
189	else
190		return oXML.LoadUrl( sUrl ) ;
191
192	return null ;
193}
194oConnector.CheckError = function( responseXml )
195{
196	var iErrorNumber = 0 ;
197	var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;
198
199	if ( oErrorNode )
200	{
201		iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ;
202
203		switch ( iErrorNumber )
204		{
205			case 0 :
206				break ;
207			case 1 :	// Custom error. Message placed in the "text" attribute.
208				//alert( oErrorNode.attributes.getNamedItem('text').value ) ;
209                alert(translateErrorAny(oErrorNode.attributes.getNamedItem('text').value )) ;
210				break ;
211			case 101 :
212                                alert(translateItem('FileBrowserError_101', 'Folder already exists' ));
213				break ;
214			case 102 :
215                                alert(translateItem('FileBrowserError_102', 'Invalid folder name' ));
216				break ;
217			case 103 :
218                                alert(translateItem('FileBrowserError_103', 'You have no permissions to create the folder' ));
219				break ;
220			case 110 :
221                                alert(translateItem('FileBrowserError_110', 'Unknown error creating folder' ));
222				break ;
223			case 204 :
224                                alert(translateItem('FileBrowserError_204', 'Unable to delete the selected file' ));
225				break ;
226			case 205 :
227                                alert(translateItem('FileBrowserError_205',
228                                 'Unable to rename the selected file; check your directory/write permisssions' ));
229				break ;
230			default :
231                                var err_default =  translateItem('FileBrowserError_default', 'Error on your request. Error number: ' );
232				alert(err_default + iErrorNumber ) ;
233				break ;
234		}
235	}
236	return iErrorNumber ;
237}
238
239var oIcons = new Object() ;
240
241oIcons.AvailableIconsArray = [
242	'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
243	'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
244
245oIcons.AvailableIcons = new Object() ;
246
247for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
248	oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
249
250oIcons.GetIcon = function( fileName )
251{
252	var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;
253
254	if ( this.AvailableIcons[ sExtension ] == true )
255		return sExtension ;
256	else
257		return 'default.icon' ;
258}
259
260function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
261{
262  //  alert( errorNumber +"\nurl="+ fileUrl+"\nfname="+ fileName+"\nmsg="+ customMsg );
263    fileUrl = fileUrl.replace(/.*?(media|userfiles\/image|file)\//,"");
264 //alert(fileUrl);
265
266	if (errorNumber == "1" || parseInt(errorNumber) > 300)
267		window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
268	else {
269		window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
270         fileUrl = encodeURIComponent(fileUrl);
271         opener.ckged_setmedia(fileUrl,"") ;
272        }
273}
274
275function fbsz_inc(val) {
276    var d = new Date();
277    if(val == 'reset') {
278        document.cookie ="fbsz=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
279        alert(translateItem('DlgFileBrowserResizeMsg', "The file browser window will be reset to its default size after your page is reloaded into the editor."));
280       // alert("The file browser window will be reset to its default size after your page is reloaded into the editor.")
281        return;
282    }
283   d.setTime(d.getTime() + 365*24*60*60*1000);
284   var expires = "expires="+d.toUTCString();
285   document.cookie =  "fbsz=" + val + "; " + expires + "; path=/";
286   alert("The file browser window will be re-sized by "+  val + "% after your page is reloaded into the editor.")
287}
288
289function fb_sort(type) {
290    window.frames['frmResourcesList'].sortFileList(type);
291}
292function  fb_search(f) {
293   window.frames['frmResourcesList'].findFiles(f.fsearch.value);
294}
295function fb_sz_date_order(el) {
296   window.frames['frmResourcesList'].reverseListOrder(el.checked);
297}
298
299function onSubmitFn() {
300  alert("use the button to submit");
301  return false;
302}
303		</script>
304	</head>
305    <body>
306    <div id="help">
307       <h3><span fckLang="DlgFileBrowserButtonHelp"></span></h3>
308       <ol>
309         <li>
310         <span  fckLang="DlgFileBrowserInfo_1" >
311          If you increase the zoom level of your browser,  ckgedit's file browser may exceed the size of its   enclosing window, forcing scrollbars.  To eliminate the scrollbars,
312          you can enlarge the window up to 20%.  The  new size takes effect after you have closed and re-opened  the editor. Resizing uses a cookie with a year's duration.
313         </span>
314         </li>
315         <li>
316           <span  fckLang="DlgFileBrowserInfo_2">
317          The file listings can be sorted by Name, Date, and File Size.  By default they sort in ascending order, but Date and File Size can
318          be sorted in descending order by checking the Reverse Order option.  The sort functions are not supported in Internet Explorer but do work in Win 10 Edge.
319          </span>
320         </li>
321         <li>
322         <span  fckLang="DlgFileBrowserInfo_3">The search function will search for whole or part of a file name.</span>
323         </li>
324         </ol>
325          <div class='closebut'><form><input type="button" onclick="document.getElementById('help').style.visibility='hidden';"  class='closebut'" value="Close"></form></div>
326
327
328    </div >
329    <div id='wrapper'>
330          <div class="left_sidebar">
331               <iframe src="frmresourcetype.html" height="50" width="180"></iframe>
332              <iframe name="frmFolders" id="frmFolders" src="frmfolders.html" scrolling="auto"  width="180" height="490" ></iframe>
333        </div>
334        <div class="right_page">
335           <div class="frameborder">
336            <iframe  name="frmActualFolder"  id="frmActualFolder" src="frmactualfolder.html" frameborder="0" width=750"  height="50"></iframe>
337            </div>
338             <div class="frameborder">
339            <iframe name="frmResourcesList" class="resourceslist" src="frmresourceslist.html"  frameborder="0" id="frmResourcesList"  width="758"   height="400"  scrolling="auto"></iframe>
340            </div>
341             <div id="bottom_matter">
342                <div id="create_folder"  class="createfolder" style="display:none">
343                    <table  class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
344                        <tr>
345                            <td>
346                                <button id = "btn__create_folder" type="button" style="WIDTH: 100%" onclick="window.frames['frmCreateFolder'].CreateFolder();">
347                                    <table cellSpacing="0" cellPadding="0" border="0">
348                                        <tr id="create_folder_img">
349                                            <td><img height="15" alt="" src="images/Folder.gif" width="15"></td>
350                                            <td>&nbsp;</td>
351                                            <td nowrap><span fckLang="DlgFileBrowserNewFolder">Create Folder</span></td>
352                                        </tr>
353                                    </table>
354                                </button>
355                            </td>
356                        </tr>
357                    </table>
358                 </div>
359                <div   class="frmupload">
360                          <iframe name="frmUpload" src="frmupload.html"  frameborder="0" width="598" height="60" ></iframe>
361                </div>
362                <div style="display:none">
363                 <iframe name="frmCreateFolder"  frameborder="0"  height="0"  width="0" src="frmcreatefolder.html"></iframe>
364                </div> <table><tr><td colspan="2">
365                <form id= adjustfbsz"><span fckLang="DlgFileBrowserAdjustSize">Adjust browser window size</span>: 5%<input type="radio" name="adjfbsz" id = "adjfbsz5"onchange="fbsz_inc(5);">&nbsp;10%<input type="radio" name="adjfbsz"  id = "adjfbsz10" onchange="fbsz_inc(10);"> &nbsp; 15%<input type="radio" name="adjfbsz" id = "adjfbsz15" onchange="fbsz_inc(15);">
366                 &nbsp; 20%<input type="radio" name="adjfbsz" id = "adjfbsz20" onchange="fbsz_inc(20);">&nbsp; -10%<input type="radio" name="adjfbsz" id = "adjfbsz-10" onchange="fbsz_inc(-10);">
367                &nbsp; -20%<input type="radio" name="adjfbsz" id = "adjfbsz-20" onchange="fbsz_inc(-20);">&nbsp;<span fckLang="DlgFileBrowserReset"> Reset</span><input type="radio" name="adjfbsz" onchange="fbsz_inc('reset');"></form>
368                </td></tr>
369                <tr><td ><form  onsubmit="return onSubmitFn();"><div  id="adustfbbuttons"><span fckLang="DlgFileBrowserSortBy">Sort by</span>:&nbsp;&nbsp;  <span fckLang="DlgFileBrowserSortName">Name</span><input type="radio" name="srtbrfiles" onchange="fb_sort('name');">&nbsp;&nbsp;<span fckLang="DlgFileBrowserSortDate">Date</span><input type="radio" name="srtbrfiles" onchange="fb_sort('mtime');">&nbsp;&nbsp;<span fckLang="DlgFileBrowserSortSize">File Size</span><input type="radio" name="srtbrfiles" onchange="fb_sort('fsize');">&nbsp;&nbsp;<span fckLang="DlgFileBrowserSortOrder">Reverse Order</span><input type="checkbox" name="srtbrorder" id="srtbrorder" onchange="fb_sz_date_order(this);"></div>
370                </td><td class="ckg_td1"><input type="button" name="srtbrfiles" onclick="fb_search(this.form)" fckLang="DlgFileBrowserSearch" value="Find files(s):"> <input type="text" name="fsearch" id="fsearch">&nbsp;&nbsp;<input type="button" name="srtbrfiles" onclick="document.getElementById('help').style.visibility='visible';" fckLang="DlgFileBrowserButtonHelp" value="Help"> </form></td></tr></table>
371              </div>
372
373        </div>
374	    <iframe name="frmUploadWorker" src="javascript:void(0)" style="height:0px;width:0px">
375
376    </div>
377</body>
378</html>
379