First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Ensure that only valid user types have access to this module
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Supplier');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
echo("<br>\n");
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<br>
|
||||
<form method='post' enctype='multipart/form-data' action='/'>
|
||||
<?php
|
||||
if (isset($errorMessages) && count($errorMessages) > 0) {
|
||||
for ($i = 0; $i < count($errorMessages); $i++) {
|
||||
echo($errorMessages[$i] . "<br>\n");
|
||||
}
|
||||
echo("<br>\n");
|
||||
}
|
||||
|
||||
$message_width = $default_form_width;
|
||||
include "form.messages.php";
|
||||
?>
|
||||
<table width='<?php echo($default_form_width) ?>' class='content-table'>
|
||||
<tr>
|
||||
<td colspan='2' align='center' class='heading'>Product Images Upload</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='center'> </td>
|
||||
</tr>
|
||||
<?php
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$fname = "filename$i";
|
||||
?>
|
||||
<tr>
|
||||
<td width='35%' align='right' valign='top'>Image <?php echo($i) ?>: </td>
|
||||
<td width='65%' align='left' valign='top'><input type='file' name='<?php echo($fname) ?>' id='<?php echo($fname) ?>' size='40'></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan='2' align='center'>
|
||||
<br>
|
||||
<input type='submit' class='btn btn--primary' value='Upload Images'>
|
||||
<input type='hidden' name='action' value='supplier-products'>
|
||||
<input type='hidden' name='naction' value='upload-image'>
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
// Determine if there are any images available
|
||||
$files = array();
|
||||
if (is_dir($imagedir)) {
|
||||
$dir = opendir($imagedir);
|
||||
while (($file = readdir($dir)) != false) {
|
||||
if ($file == ".") continue;
|
||||
if ($file == "..") continue;
|
||||
$files[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($files) > 0) {
|
||||
sort($files);
|
||||
?>
|
||||
<br>
|
||||
<form method='post' action='/'>
|
||||
<table width='<?php echo($default_form_width) ?>' class='content-table'>
|
||||
<tr>
|
||||
<td align='center' class='heading'><?php displayLanguageText('TEXT-PRODUCT-IMAGES-DELETE'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='65%' align='center' valign='top'>
|
||||
<br>
|
||||
<div id='images-list-div' style='width: 500px; border: 1px solid black;'></div>
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php include "include/ajax.Setup.php"; ?>
|
||||
|
||||
loadImages();
|
||||
|
||||
function loadImages() {
|
||||
$("#images-list-div").html("<p><img src='images/spinner.gif'></p>");
|
||||
|
||||
// Format parameters
|
||||
var data = "table_name=images"+
|
||||
"&sequence_flag=N"+
|
||||
"&action=load-image-list"
|
||||
// Get data table
|
||||
$.getJSON( "ajax.DataTable.Fetch.php",data,
|
||||
function(results) {
|
||||
$("#images-list-div").html(results.content);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$(document).on('click', '.image-delete', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var fname = $(this).attr('image');
|
||||
if (confirm("<?php displayLanguageText('TEXT-CONFIRM-DELETE'); ?>: "+fname)) {
|
||||
$.ajax({
|
||||
url: "ajax.deleteSelectedImage.php",
|
||||
data: {
|
||||
selected_image: fname
|
||||
},
|
||||
dataType: "json",
|
||||
error:
|
||||
function(jqXHR, exception) {
|
||||
alert("Exception: "+jqXHR.status+' '+jqXHR.statusText);
|
||||
}
|
||||
}).done(
|
||||
function(results) {
|
||||
alert(results.ajax_message);
|
||||
loadImages();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user