File: //proc/self/root/home/awaldron/public_html/archive/ras/admin/gallery/index.php
<?php
include "../../f_db.php";
dbconnect();
$g_list = '';
$galleries = rset("SELECT * FROM ras_gallery ORDER BY gal_title ASC");
foreach ($galleries as $g) {
if (!isset($_GET['gal'])) {
$_GET['gal'] = $g['gal_id'];
}
$g_list .= '<a href="index.php?gal='.$g['gal_id'].'" class="ras-gallery '.($_GET['gal']==$g['gal_id'] ? ' gallery-on' : 'gallery-drop').'" id="gal-'.$g['gal_id'].'"><span style="color:#999;">('.$g['gal_id'].')</span> '.$g['gal_title'].' <span class="copied" id="copy-'.$g['gal_id'].'">copied!</span></a>';
if ($_GET['gal']==$g['gal_id']) {
$g_title = $g['gal_title'];
$g_desc = $g['gal_desc'];
}
}
$p_list = '<ul id="sortable">';
$p_edit = '';
$photos = rset("SELECT * FROM ras_gallery_phogal as A, ras_gallery_photo as B WHERE A.gal_id=".$_GET['gal']." AND A.photo_id=B.photo_id ORDER BY A.`order` ASC");
if ($photos) {
foreach ($photos as $p) {
list($w,$h) = getimagesize('../../gallery/lg_'.$p['photo_file']);
$p_list .= '<li class="photo-drag" id="photo-'.$p['photo_id'].'" rel="order-'.$p['order'].'"><img src="/gallery/tn_'.$p['photo_file'].'" /><a href="#photo-edit-'.$p['photo_id'].'" rel="shadowbox;height=750;width=680"><img src="gui/editphoto.gif" class="edit-photo" /></a></li>';
$p_edit .= '<div class="photo_edit" id="photo-edit-'.$p['photo_id'].'">
<center><img class="scale" src="/gallery/lg_'.$p['photo_file'].'" style="margin-top:20px;" width='.($w*0.75).' height='.($h*0.75).' /></center>
<form action="photo_edit.php" method="post" style="margin-left:50px;">
<input type="hidden" name="photo_id" value="'.$p['photo_id'].'" />
<input type="hidden" name="gal_id" value="'.$_GET['gal'].'" />
<p><b>Photo Title</b><br/><input type="text" name="photo_title" value="'.$p['photo_title'].'" style="width:300px;" maxlength=255 /></p>
<p><b>Photo Description</b><br/><textarea name="photo_desc" style="width:300px;height:80px;">'.$p['photo_desc'].'</textarea></p>
<p><input type="submit" name="submit" value="Submit" /></p>
</form>
</div>';
}
} else {
$p_list .= 'This gallery is empty.';
}
$p_list .= '</ul>';
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>R.A. Snoznik Gallery Manager</title>
<link rel="stylesheet" href="css/uploadify.css" type="text/css" />
<link rel="stylesheet" href="css/uploadify.styling.css" type="text/css" />
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.11.custom.css" type="text/css" />
<link rel="stylesheet" href="css/ras_gallery_style.css" type="text/css" />
<link rel="stylesheet" href="css/shadowbox.css" type="text/css" />
<link rel="stylesheet" href="css/prettyLoader.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript" src="js/shadowbox.js"></script>
<script type="text/javascript" src="js/jquery.prettyLoader.js"></script>
<script type="text/javascript">
<!--
$(function() {
var gal = <?=$_GET['gal']?>;
var drop_action = "move";
Shadowbox.init({ enableKeys: false });
$.prettyLoader({
animation_speed: 'fast', /* fast/normal/slow/integer */
bind_to_ajax: false, /* true/false */
delay: false, /* false OR time in milliseconds (ms) */
loader: '/admin/gallery/gui/copy.png', /* Path to your loader gif */
offset_top: 13, /* integer */
offset_left: 10 /* integer */
});
$('#file_upload').uploadify({
'uploader' : 'uploadify/uploadify.swf',
'script' : 'uploadify/uploadify.php?gal='+gal,
'cancelImg' : 'uploadify/cancel.png',
'folder' : 'staging',
'multi' : true,
'fileExt' : '*.jpg',
'fileDesc' : 'Image Files (.JPG)',
'queueSizeLimit' : 25,
'simUploadLimit' : 1,
'removeCompleted': true,
'onAllComplete' : function(event,data) {
location.reload();
}
});
$('#main-right ul li').hover(
function() { $(this).addClass('gallery-over'); },
function() { $(this).removeClass('gallery-over'); }
);
$( "#sortable" ).sortable({
revert: true,
connectWith: ".gallery-drop",
opacity:0.5,
update: function(event, ui) {
var sorted = $("#sortable").sortable('toArray');
$('#loader').load('gallery_sort.php', { 'arr' : sorted, 'gal' : <?=$_GET['gal']?> });
}
}).disableSelection();
$(".ras-gallery").draggable({
revert:true,
opacity:0.5
});
$(".gallery-drop").droppable({
accept: ".photo-drag",
connectWith: "#sortable",
hoverClass: "gallery-over",
activate: function(ev, ui) {
// check for move/copy
if ( (ev.originalEvent.ctrlKey) || (ev.originalEvent.metaKey) ) {
drop_action = "copy";
$.prettyLoader.show();
} else {
drop_action = "move";
}
},
drop: function(ev, ui) {
$.prettyLoader.hide();
if (drop_action == "move") {
var dropId = $(this).attr('id').substr(4);
var photoId = ui.draggable.attr('id').substr(6);
$('#loader').load('photo_move.php', { 'curgal' : <?=$_GET['gal']?>, 'moveto' : dropId, 'pid' : photoId },
function(data) {
var res = data.substr(0,3);
if (res != "ERR") ui.draggable.remove();
}
);
} else if (drop_action == "copy") {
var dropId = $(this).attr('id').substr(4);
var photoId = ui.draggable.attr('id').substr(6);
$('#loader').load('photo_copy.php', { 'copyto' : dropId, 'pid' : photoId });
$('#copy-'+dropId).fadeIn().delay(2500).fadeOut();
}
},
deactivate: function(ev, ui) {
$.prettyLoader.hide();
}
});
$(".garbage").droppable({
accept: ".photo-drag, .ras-gallery",
connectWith: "#sortable",
hoverClass: "garbage-over",
drop: function(ev, ui) {
var droppedID = ui.draggable.attr('id');
var dropType = ui.draggable.attr('id').substr(0,3);
if (dropType == "pho") {
var yn = confirm("Are you sure you want to delete this photo?");
if (yn) {
var dragId = ui.draggable.attr('id');
$('#loader').load('photo_delete.php', { 'pid' : dragId, 'gal' : <?=$_GET['gal']?> });
ui.draggable.fadeOut();
} else return false;
}
else if (dropType == "gal") {
var yn = confirm("Are you sure you want to delete this gallery and all of the photos within it?");
if (yn) {
var dragId = ui.draggable.attr('id');
$('#loader').load('gallery_delete.php', { 'gal' : dragId },
function() { ui.draggable.remove(); location.href = 'index.php'; }
);
} else return false;
}
}
});
//$('.scale').load(function() {
// var w = $(this).attr('width');
// //alert(w);
// var h = $(this).attr('height');
// var ratio = 600 / w;
// var new_w = w * 0.75;
// var new_h = h * 0.75;
// $(this).attr('width',new_w).attr('height',new_h);
//});
});
-->
</script>
</head>
<body>
<h1>R.A. Snoznik - Gallery Manager</h1>
<hr/><br/>
<table border=0 width=100%>
<tr><td valign="top" width="275">
<div id="ras-upload">
<div id="select-button"><span id="select-button-txt">Upload Photos:</span> <input id="file_upload" type="file" name="Filedata" /></div>
<center>
<br/><a href="javascript:$('#file_upload').uploadifyUpload()">Upload Files</a> <a href="javascript:$('#file_upload').uploadifyClearQueue()">Clear Queue</a>
<br/>Max filesize: <b style="color:red"><?=ini_get('upload_max_filesize')?>b</b> per file.
</center>
</div>
<div id="ras-galleries">
<div style="margin:10px 0 5px 0;font:22px Arial bold;">Galleries<a href="#new-gallery-form" rel="shadowbox"><img src="/gui/new.gif" id="new-gallery" /></a></div>
<?=$g_list?>
</div>
<center><br/><div class="garbage"></div></center>
</td><td valign="top">
<div id="main-right">
<h1><?=$g_title?> <a href="#edit-gallery-form" rel="shadowbox"><img src="/gui/edit.gif"></a></h1>
<?=$p_list?>
</div>
</td></tr></table>
<div id="new-gallery-form" class="hidden-form">
<h2>Create a New Gallery</h2>
<hr/><br/>
<form action="gallery_new.php" method="post" style="margin-left:20px;">
<p><b>Gallery Title</b><br/><input type="text" name="gal_title" value="" style="width:300px;" maxlength=255 /></p>
<p><b>Gallery Description</b><br/><input type="text" name="gal_desc" value="" style="width:300px;" maxlength=255 /></p>
<p><input type="submit" name="gal_submit" value="Submit" /></p>
</form>
</div>
<div id="edit-gallery-form" class="hidden-form">
<h2>Edit Gallery</h2>
<hr/><br/>
<form action="gallery_edit.php" method="post" style="margin-left:20px;">
<input type="hidden" name="gal_id" value="<?=$_GET['gal']?>" />
<p><b>Gallery Title</b><br/><input type="text" name="gal_title" value="<?=$g_title?>" style="width:300px;" maxlength=255 /></p>
<p><b>Gallery Description</b><br/><input type="text" name="gal_desc" value="<?=$g_desc?>" style="width:300px;" maxlength=255 /></p>
<p><input type="submit" name="gal_submit" value="Submit" /></p>
</form>
</div>
<?=$p_edit?>
<div id="loader"></div>
</body>
</html>