summaryrefslogtreecommitdiff
path: root/views/mods/mod_orderupload
diff options
context:
space:
mode:
Diffstat (limited to 'views/mods/mod_orderupload')
-rw-r--r--views/mods/mod_orderupload/basket_after.phtml81
-rw-r--r--views/mods/mod_orderupload/basket_row.phtml47
-rw-r--r--views/mods/mod_orderupload/basket_row_upload_target.phtml30
-rw-r--r--views/mods/mod_orderupload/order_view_row.phtml16
-rw-r--r--views/mods/mod_orderupload/product_addedit_content.phtml45
5 files changed, 178 insertions, 41 deletions
diff --git a/views/mods/mod_orderupload/basket_after.phtml b/views/mods/mod_orderupload/basket_after.phtml
new file mode 100644
index 0000000..a8b4a6e
--- /dev/null
+++ b/views/mods/mod_orderupload/basket_after.phtml
@@ -0,0 +1,81 @@
+<?php
+
+ /**
+ * User: Daschmi (daschmi@daschmi.de)
+ * Date: 02.05.2018
+ * Time: 10:47
+ */
+
+?>
+
+<script>
+
+ function wpsg_mod_orderupload_upload(product_index, product_id) {
+
+ var files = document.getElementById('wpsg_mod_orderupload_' + product_index + '_file').files;
+ var formData = new FormData();
+
+ for (var i = 0; i < files.length; i++) {
+
+ var file = files[i];
+
+ formData.append('file[]', file, file.name);
+
+ }
+
+ formData.append('product_index', product_index);
+ formData.append('product_id', product_id);
+ formData.append('order_id', '<?php echo $_SESSION['wpsg']['order_id']; ?>');
+ formData.append('action', 'wpsg_mod_orderupload_upload');
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.open('POST', wpsg_ajax.ajaxurl, true);
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html('<?php echo __('Bitte warten ', 'wpsg'); ?><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
+
+ xhr.onload = function () {
+
+ if (xhr.status === 200) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html(xhr.responseText);
+
+ } else {
+
+ alert("<?php echo __('Fehler', 'wpsg'); ?>: " + xhr.responseText);
+
+ }
+
+ };
+
+ xhr.send(formData);
+
+ return false;
+
+ }
+
+ function wpsg_mod_orderupload_removefile(file, product_index, product_id) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html('<?php echo __('Bitte warten ', 'wpsg'); ?><img src="' + wpsg_ajax.img_ajaxloading + '" alt="' + wpsg_ajax.label_pleasewait + '" /></div>');
+
+ jQuery.ajax( {
+ url: wpsg_ajax.ajaxurl,
+ data: {
+ action: 'wpsg_mod_orderupload_delete',
+ order_id: <?php echo $_SESSION['wpsg']['order_id'] ?>,
+ product_index: product_index,
+ product_id: product_id,
+ file: file
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_mod_orderupload_' + product_index + '_target').html(data);
+
+ }
+ } );
+
+ return false;
+
+ } // wpsg_mod_orderupload_removefile(aElement)
+
+</script>
diff --git a/views/mods/mod_orderupload/basket_row.phtml b/views/mods/mod_orderupload/basket_row.phtml
index 336ff9b..205fbbb 100644
--- a/views/mods/mod_orderupload/basket_row.phtml
+++ b/views/mods/mod_orderupload/basket_row.phtml
@@ -5,49 +5,14 @@
*/
?>
-<div class="wpsg_box wpsg_mod_orderupload">
+<div class="product_info product_upload">
- <div class="wpsg_head"><?php echo __('Dateiupload:', 'wpsg'); ?>
-
- <?php if ($this->get_option('wpsg_mod_orderupload_optional') != '1') { ?>
-
- <span class="wpsg_required">*</span>
-
- <?php } ?>
-
- </div>
+ <?php echo __('Upload zum Produkt', 'wpsg'); ?>:
- <div class="wpsg_inner">
-
- <?php if ($this->view['wpsg_mod_orderupload']['uploadsum'] > 0) { ?>
- <input class="wpsg_orderupload_checkout_button" type="file" name="wpsg_mod_orderupload_file" />
- <?php } ?>
-
- <?php /* Auflistung der bereits hochgeladenen Dokumente */ ?>
- <?php if (wpsg_isSizedArray($_SESSION['wpsg']['wpsg_mod_orderupload'])) { ?>
-
- <br />
-
- <label class="wpsg_checkout"><?php echo __('Bisher hochgeladene Dokumente', 'wpsg'); ?>:</label><br />
-
- <?php foreach ($_SESSION['wpsg']['wpsg_mod_orderupload'] as $ou_index => $ou) { ?>
-
- <?php /* Dokument aus der Liste löschen */ ?>
- <a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie dieses Dokument aus der Bestellung entfernen möchten?', 'wpsg'); ?>');" href="?wpsg_plugin=wpsg_mod_orderupload&wpsg_action=remove&file_index=<?php echo $ou_index; ?>" class="wpsg_mod_orderupload_removelink">
- <img src="<?php echo WPSG_URL; ?>views/gfx/bin_x.png" alt="<?php echo __('Löschen', 'wpsg'); ?>" />
- </a>
+ <div id="wpsg_mod_orderupload_<?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>_target" class="wpsg_mod_orderupload_target">
+
+ <?php echo $this->view['wpsg_mod_orderupload']['strHTMLTarget']; ?>
- <a href="<?php echo $ou[2]; ?>"><?php echo wpsg_hspc($ou[0]); ?></a>&nbsp;<?php echo '('.wpsg_formatSize($ou[3]).')'; ?><br />
-
- <?php } ?>
-
- <?php } ?>
-
</div>
-
- <?php /* Counter, wie viel MB noch übrig sind */?>
- <label class="wpsg_fileweight">
- <?php echo wpsg_translate(__('Es stehen Ihnen #1# Mb von #2# Mb für den Upload zur Verfügung', 'wpsg'), $this->view['wpsg_mod_orderupload']['uploadsum'],$this->view['wpsg_mod_orderupload']['maxweight']);?>
- </label>
-
+
</div> \ No newline at end of file
diff --git a/views/mods/mod_orderupload/basket_row_upload_target.phtml b/views/mods/mod_orderupload/basket_row_upload_target.phtml
new file mode 100644
index 0000000..5a32de8
--- /dev/null
+++ b/views/mods/mod_orderupload/basket_row_upload_target.phtml
@@ -0,0 +1,30 @@
+<?php echo $this->writeFrontendMessage(); ?>
+
+<?php if (wpsg_isSizedArray($this->view['wpsg_mod_orderupload']['arFiles'])) { ?>
+
+ <ul>
+
+ <?php foreach ($this->view['wpsg_mod_orderupload']['arFiles'] as $f) { ?>
+
+ <li>
+
+ <a href=""><?php echo basename($f); ?> <span class="size">(<?php echo wpsg_formatSize($f); ?>)</span></a>
+
+ <a title="<?php echo __('Upload entfernen.', 'wpsg'); ?>" class="removeLink" onclick="return wpsg_mod_orderupload_removefile('<?php echo rawurlencode(basename($f)); ?>', <?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>, <?php echo $this->view['wpsg_mod_orderupload']['product_id']; ?>);" href="#">
+ <img src="<?php echo WPSG_URL; ?>views/gfx/bin_x.png" alt="<?php echo __('Löschen', 'wpsg'); ?>" />
+ </a>
+
+ </li>
+
+ <?php } ?>
+
+ </ul>
+
+<?php } ?>
+
+<?php if ($this->view['wpsg_mod_orderupload']['oProduct']->wpsg_mod_orderupload_set > sizeof($this->view['wpsg_mod_orderupload']['arFiles'])) { ?>
+
+ <input type="file" id="wpsg_mod_orderupload_<?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>_file" name="wpsg_mod_orderupload[<?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>]" multiple="multiple" />
+ <input type="button" onclick="return wpsg_mod_orderupload_upload(<?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>, <?php echo $this->view['wpsg_mod_orderupload']['product_id']; ?>);" id="wpsg_mod_orderupload_<?php echo $this->view['wpsg_mod_orderupload']['product_index']; ?>_button" value="<?php echo __('Hochladen', 'wpsg'); ?>" />
+
+<?php } ?> \ No newline at end of file
diff --git a/views/mods/mod_orderupload/order_view_row.phtml b/views/mods/mod_orderupload/order_view_row.phtml
new file mode 100644
index 0000000..4468d5e
--- /dev/null
+++ b/views/mods/mod_orderupload/order_view_row.phtml
@@ -0,0 +1,16 @@
+<?php
+
+ /**
+ * Template für die Integration des Produktuploads in die Bestellverwaltung Reiter "Bestelldaten"
+ */
+
+ $view = $this->view['wpsg_mod_orderupload'];
+
+?>
+<tr class="wpsg_<?php echo (($view['i'] == 0)?'odd':'even'); ?>">
+ <td align="left" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'5':'4'); ?>">
+ <label>
+ <?php echo wpsg_translate(__('Produktuploads: #1#', 'wpsg'), implode(', ', $view['arFileDownloadLinks'])); ?>
+ </label>
+ </td>
+</tr> \ No newline at end of file
diff --git a/views/mods/mod_orderupload/product_addedit_content.phtml b/views/mods/mod_orderupload/product_addedit_content.phtml
new file mode 100644
index 0000000..715c3d3
--- /dev/null
+++ b/views/mods/mod_orderupload/product_addedit_content.phtml
@@ -0,0 +1,45 @@
+<?php
+
+ /**
+ * User: Daschmi (daschmi@daschmi.de)
+ * Date: 02.05.2018
+ * Time: 07:25
+ */
+
+?>
+
+<?php echo wpsg_drawForm_AdminboxStart(__('Bestellupload', 'wpsg')); ?>
+
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_orderupload_set', __('Bestellupload ermöglichen'), (($this->view['wpsg_mod_orderupload']['set'] > 0)?true:false)); ?>
+
+ <div class="wpsg_mod_orderupload_set_1" style="<?php echo (($this->view['wpsg_mod_orderupload']['set'] > 0)?'display:block;':'display:none;'); ?>">
+
+ <?php echo wpsg_drawForm_Input('wpsg_mod_orderupload[set]', __('Maximale Anzahl an Uploads'), $this->view['wpsg_mod_orderupload']['set']); ?>
+ <?php echo wpsg_drawForm_Checkbox('wpsg_mod_orderupload[mandatory]', __('Pflichtfeld'), $this->view['wpsg_mod_orderupload']['mandatory']); ?>
+
+ </div>
+
+ <script>
+
+ jQuery(document).ready(function() {
+
+ jQuery('#wpsg_mod_orderupload_set').on('change', function() {
+
+ if (jQuery(this).prop('checked') === true) {
+
+ jQuery('.wpsg_mod_orderupload_set_1').show();
+ jQuery('#wpsg_mod_orderuploadset').focus();
+
+ } else {
+
+ jQuery('.wpsg_mod_orderupload_set_1').hide();
+
+ }
+
+ } ).change();
+
+ } );
+
+ </script>
+
+<?php echo wpsg_drawForm_AdminboxEnd(); ?> \ No newline at end of file