Location: PHPKode > projects > Buzzword > buzzword-0.8.12/gallery/filebrowser.php
<?php

/*
 * buzzword
 * Copyright (c) 2003 Jon Tai
 *
 * $Id: filebrowser.php 355 2004-04-27 21:54:25Z bradt $
 *
 * This file is part of buzzword.
 *
 * buzzword is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * buzzword 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with buzzword; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

require_once './config.inc';
force_admin_login();

$element = import_gallery_element_name();
$form = import_gallery_form_name();

$gallery = new gallery_gallery(import_gallery_gallery_key());
if (!$gallery->exists())
    display_error('gallery does not exist');

header('Content-Type: text/html; charset=ISO-8859-1');

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Select Image</title>
<link rel="stylesheet" type="text/css" href="../style.css">
<?php echo stylesheet_hook(); ?>
<script language="JavaScript" type="text/javascript">
<!--

<?php 

if ( ($element != '') ) {

?>
function filebrowser_insert(image_key) {
    var ta = self.opener.document.<?php echo $form; ?>.<?php echo $element; ?>;

    if (document.selection) {
        ta.focus();
        var sel = document.selection.createRange();
        sel.text = '<gallery image_key=\"' + image_key + '\">';
    } else if (ta.selectionStart || ta.selectionStart == "0") {
        var start = ta.selectionStart;
        var end = ta.selectionEnd;
        var val = ta.value;
        ta.value = val.substring(0, start) + '<gallery image_key=\"' + image_key + '\">' + val.substring(end, val.length);
    } else {
        ta.value += '<gallery image_key=\"' + image_key + '\">';
    }

    self.close();
}
<?php

} else {

?>
function filebrowser_set_highlight(image_key) {
    self.opener.document.<?php echo $form; ?>.highlight.value = image_key;
    if (self.opener.document.images.highlight) 
        self.opener.document.images.highlight.src = '../gallery/thumb.php?i=' + image_key;
    self.close();
}

<?php

}

?>
// -->
</script>
</head>
<body>
<table cellpadding=0 cellspacing=3 border=0 height="100%">
<tr>
<td id="sidebar" style="padding: 10px 0px 0px 5px;">
<div class="sidebar-container">
<?php gallery_filebrowser_print_tree($form, $element, import_gallery_gallery_key()); ?>
</div>
</td>
<td id="content" style="padding: 10px 5px 0px 0px;">
<div class="content-container">
<?php

$images = get_gallery_images($gallery->gallery_key);
foreach($images as $image) {
    if ( ($element != '') && ($form != '') ) {

?>
<a href="#" onClick="filebrowser_insert(<?php echo $image->image_key; ?>);"><img 
 src="thumb.php?i=<?php echo $image->image_key; ?>" <?php echo $image->get_alt(); ?> 
 border="0" <?php echo $image->get_thumb_size(); ?>></a>
<?php

    } else {

?>
<a href="#" onClick="filebrowser_set_highlight(<?php echo $image->image_key; ?>);"><img 
 src="thumb.php?i=<?php echo $image->image_key; ?>" <?php echo $image->get_alt(); ?> 
 border="0" <?php echo $image->get_thumb_size(); ?>></a>
<?php

    }
}

if (!count($images))
    echo "<center><i>No images in this gallery</i></center>\n";

?>
</div>
</td>
</tr>
</table>
</body>
</html>
Return current item: Buzzword