Source for file file_dialog.php
Documentation is available at file_dialog.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
* phpDocumentor :: docBuilder Web Interface
* Advanced Web Interface to phpDocumentor
* Copyright (c) 2003-2006 Andrew Eddie, Greg Beaver
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* @copyright 2003-2006 Andrew Eddie, Greg Beaver
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version CVS: $Id: file_dialog.php 231860 2007-03-14 12:48:37Z ashnazg $
print "phpDocumentor requires PHP version 4.1.0 or greater to function";
if ('@WEB-DIR@' != '@'. 'WEB-DIR@')
* common file information
require_once 'PhpDocumentor/phpDocumentor/common.inc.php';
require_once 'PhpDocumentor/HTML_TreeMenu-1.1.2/TreeMenu.php';
require_once( '@WEB-DIR@' . PATH_DELIMITER . 'PhpDocumentor/docbuilder/includes/utilities.php' );
define(PHPDOC_WEBROOT_DIR, 'PhpDocumentor');
// set up include path so we can find all files, no matter what
// find the .ini directory by parsing phpDocumentor.ini and extracting _phpDocumentor_options[userdir]
if (isset ($ini['_phpDocumentor_options']['userdir'])) {
$configdir = $ini['_phpDocumentor_options']['userdir'];
define(PHPDOC_WEBROOT_DIR, dirname(dirname(__FILE__ )));
* common file information
include_once(PHPDOC_WEBROOT_DIR . "/phpDocumentor/common.inc.php");
include_once(PHPDOC_WEBROOT_DIR . "/HTML_TreeMenu-1.1.2/TreeMenu.php");
include_once(PHPDOC_WEBROOT_DIR . "/docbuilder/includes/utilities.php" );
// set up include path so we can find all files, no matter what
// add my directory to the include path, and make it first, should fix any errors
if (substr(PHP_OS, 0, 3) == 'WIN') {
ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir']. ';'. ini_get('include_path'));
ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir']. ':'. ini_get('include_path'));
// find the .ini directory by parsing phpDocumentor.ini and extracting _phpDocumentor_options[userdir]
if (isset ($ini['_phpDocumentor_options']['userdir'])) {
$configdir = $ini['_phpDocumentor_options']['userdir'];
$configdir = $_phpDocumentor_install_dir . '/user';
// allow the user to change this at runtime
if (!empty( $_REQUEST['altuserdir'] )) {
$configdir = $_REQUEST['altuserdir'];
body, td, th, select, input {
font-family: verdana,sans-serif;
font-family: verdana,sans-serif;
border: solid 1px #000000;
border: solid 1px #000000;
<script src="../HTML_TreeMenu-1.1.2/TreeMenu.js" language="JavaScript" type="text/javascript"></script>
class DirNode extends HTML_TreeNode
function DirNode($text = false, $link = false, $icon = false, $path, $events = array())
if ($text) $options['text'] = $text;
if ($link) $options['link'] = $link;
if ($icon) $options['icon'] = $icon;
HTML_TreeNode::HTML_TreeNode($options,$events);
$menu = new HTML_TreeMenu();
if (isset ($_GET) && isset ($_GET['fileName'])) {
$filename = $_GET['fileName'];
$pd = (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/';
$test = ($pd == '/') ? '/' : 'C:\\';
if (empty($filename) || ($filename == $test)) {
$filename = ($pd == '/') ? '/' : 'C:\\';
// if ($pd != '/') $pd = $pd.$pd;
// recurseDir($filename,$anode);
$node = new HTML_TreeNode(array('text' => "Click to view ". addslashes($filename),'link' => "",'icon' => 'branchtop.gif'));
if ('@WEB-DIR@' != '@'. 'WEB-DIR@')
$DHTMLmenu = &new HTML_TreeMenu_DHTML($menu,
array('images' => '../HTML_TreeMenu-1.1.2/images'));
$DHTMLmenu = &new HTML_TreeMenu_DHTML($menu,
array('images' => str_replace('/docbuilder/file_dialog.php','',$_SERVER['PHP_SELF']) .
'/HTML_TreeMenu-1.1.2/images'));
<script type="text/javascript" language="Javascript">
Creates some global variables
function initializate() {
//The "platform independent" newLine
//Taken from http://developer.netscape.com/docs/manuals/communicator/jsref/brow1.htm#1010426
if (navigator.appVersion.lastIndexOf( 'Win' ) != -1) {
/* for($a=0;$a<document.dataForm.elements.length;$a++) {
alert("The name is '"+document.dataForm.elements[$a].name+"' "+$a);
/** Sets the contents of the help box, and submits the form
function setHelp( $str ) {
document.helpForm.fileName.value = $str;
document.helpForm.submit();
/** Sets the contents of the help box only
function setHelpVal( $str ) {
document.helpForm.fileName.value = $str;
/**Takes a given string and leaves it ready to add a new string
That is, puts the comma and the new line if needed
function prepareString($myString) {
//First verify that a comma is not at the end
if($myString.lastIndexOf(",") >= $myString.length-2) {
//We have a comma at the end
if($myString.length > 0) {
function myReplace($string,$text,$by) {
// Replaces text with by in string
var $strLength = $string.length, $txtLength = $text.length;
if (($strLength == 0) || ($txtLength == 0)) return $string;
var $i = $string.indexOf($text);
if ((!$i) && ($text != $string.substring(0,$txtLength))) return $string;
if ($i == -1) return $string;
var $newstr = $string.substring(0,$i) + $by;
if ($i+$txtLength < $strLength)
$newstr += myReplace($string.substring($i+$txtLength,$strLength),$text,$by);
<body bgcolor="#ffffff" onload="javascript:initializate()">
<strong>Directory Browser</strong>
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<form name="helpForm" action=" <?php print $_SERVER['PHP_SELF']; ?>" method="get" enctype="multipart/form-data">
<td colspan="2" width="100%">
Use this to find directories and files which can be used below:
<a href="javascript:document.helpForm.submit();" title="browse tree">
echo showImage( 'images/rc-gui-install-24.png', '24', '24' );
<input size="60" type="text" name="fileName" value=" <?php print $filename;?>" class="text" />
<input type="submit" name="helpdata" value="close" class="button" onclick="window.close();" />
<input type="submit" name="helpdata" value="accept" class="button" onclick="opener.setFile(document.helpForm.fileName.value);window.close();" />
<div id='menuLayer'></div>
<?php $DHTMLmenu->printMenu(); ?>
|