Browse Source

Making some progress... not much though.

merge-requests/3/head
Mike Koch 6 years ago
parent
commit
87f8572f12
  1. 2
      inc/header.inc.php
  2. 2
      inc/headerAdmin.inc.php
  3. 54
      inc/view_attachment_functions.inc.php
  4. 9
      index.php
  5. 3
      js/modsForHesk-javascript.js

2
inc/header.inc.php

@ -102,6 +102,7 @@ if (is_dir(HESK_PATH . 'install')) {
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/dropzone.min.js"></script>
<script language="Javascript" type="text/javascript"
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
<script language="JavaScript" type="text/javascript"
@ -112,7 +113,6 @@ if (is_dir(HESK_PATH . 'install')) {
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/dropzone.min.js"></script>
<style>
.navbar-default {
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;

2
inc/headerAdmin.inc.php

@ -77,6 +77,7 @@ $modsForHesk_settings = mfh_getSettings();
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/dropzone.min.js"></script>
<script language="Javascript" type="text/javascript"
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
@ -88,7 +89,6 @@ $modsForHesk_settings = mfh_getSettings();
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/dropzone.min.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core.php"></script>
<?php
if (defined('EXTRA_JS')) {

54
inc/view_attachment_functions.inc.php

@ -169,4 +169,58 @@ function mfh_getFontAwesomeIconForFileExtension($fileExtension)
$icon .= 'o';
}
return $icon;
}
function output_dropzone_window() {
echo '
<div class="table table-striped" class="files" id="preview" style="display:none">
<div id="template" class="file-row">
<!-- This is used as the file preview template -->
<div>
<span class="preview"><img data-dz-thumbnail /></span>
</div>
<div class="row">
<div class="col-md-4 col-sm-12">
<p class="name" data-dz-name></p>
<i class="fa fa-trash fa-2x" style="color: gray; cursor: pointer" title="Remove file" data-dz-remove></i>
</div>
<div class="col-md-8 col-sm-12">
<p class="size" data-dz-size></p>
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" id="total-progress">
<div class="progress-bar progress-bar-success" style="width:0%;" data-dz-uploadprogress></div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<strong class="error text-danger" data-dz-errormessage></strong>
</div>
</div>
</div>
</div>';
}
function display_dropzone_field($url) {
global $hesk_settings, $hesklang;
output_dropzone_window();
echo "
<script type=\"text/javascript\">
Dropzone.options.filedrop = {
paramName: 'file',
url: '/some/url',
parallelUploads: 1,
uploadMultiple: false,
maxFiles: 1,
acceptedFiles: '.zip, .rar, .7z',
maxFilesize: 2, // MB
dictDefaultMessage: 'Drag or click here to select your file for submission. Files must end in .zip, .rar, or .7z.',
dictInvalidFileType: 'Sorry, but the file you tried to upload does not end in .zip, .rar, or .7z.',
dictResponseError: 'Yikes, something went wrong! Please go to the Mods for HESK forums to report this issue.',
previewTemplate: $('#previews').html()
};
</script>
";
}

9
index.php

@ -36,6 +36,7 @@ define('VALIDATOR', 1);
// Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/view_attachment_functions.inc.php');
hesk_load_database_functions();
hesk_dbConnect();
@ -194,7 +195,7 @@ function print_add_ticket()
$onsubmit = 'onsubmit="return validateRichText(\'message-help-block\', \'message-group\', \'message\', \''.htmlspecialchars($hesklang['this_field_is_required']).'\')"';
}
?>
<form class="form-horizontal" role="form" method="post" action="submit_ticket.php?submit=1" name="form1"
<div class="form-horizontal" role="form" method="post" action="submit_ticket.php?submit=1" name="form1"
enctype="multipart/form-data" <?php echo $onsubmit; ?>>
<!-- Contact info -->
<div class="form-group">
@ -987,8 +988,14 @@ function print_add_ticket()
<a href="file_limits.php" target="_blank"
onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?></a>
</div>
<div class="dropzone" id="filedrop">
<div class="fallback">
<input name="file" type="file" multiple />
</div>
</div>
</div>
<?php
display_dropzone_field('ticket-attachment', 'someurl');
}
if ($hesk_settings['question_use'] || $hesk_settings['secimg_use'])

3
js/modsForHesk-javascript.js

@ -1,3 +1,6 @@
//-- Turn off Dropzone autodetection.
//Dropzone.autoDiscover = false;
//-- Activate anything Mods for HESK needs, such as tooltips.
var loadJquery = function()
{

Loading…
Cancel
Save