summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorhartmut <noreply@maennchen1.de>2017-05-04 11:52:56 +0000
committerhartmut <noreply@maennchen1.de>2017-05-04 11:52:56 +0000
commit0c0b4863a7db3a7c91db9f04b6fe3f054f4f1f60 (patch)
tree7823258a596daf890e5a93545e93f7bba4d3000f /views
parent1d03d14bcbd319c92263c92f2abd44f6493152ca (diff)
Mehrere Bilder aus Mediathek holen und Mediathek-Daten beim Löschen eines Produktes löschen
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@6248 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views')
-rw-r--r--views/mods/mod_produktbilder/produkt_addedit_content.phtml98
-rw-r--r--views/mods/mod_produktbilder/produkt_edit_list_MT.phtml4
2 files changed, 77 insertions, 25 deletions
diff --git a/views/mods/mod_produktbilder/produkt_addedit_content.phtml b/views/mods/mod_produktbilder/produkt_addedit_content.phtml
index 8019ba8..52d0eec 100644
--- a/views/mods/mod_produktbilder/produkt_addedit_content.phtml
+++ b/views/mods/mod_produktbilder/produkt_addedit_content.phtml
@@ -67,7 +67,7 @@
<!-- Mediathek -->
- <div id="produktbilder_target_MT"><?php echo $this->view['ProduktList_MT']; ?></div>
+ <div class="ui-sortable" id="produktbilder_target_MT"><?php echo $this->view['ProduktList_MT']; ?></div>
<div class="wpsg_clear"></div>
<div><?php echo __("Bitte klicken Sie auf Mediathek um ein Bild hochzuladen. Um ein Bild zu löschen klicken Sie einfach auf das Bild.", "wpsg"); ?></div>
@@ -77,6 +77,39 @@
<!-- <input value="UploadMT" class="button" type="text" style="text-align:center;" size="10" id="upload_button_mt" /> -->
<script type="text/javascript">/* <![CDATA[ */
+
+ jQuery(document).ready(function() {
+
+ jQuery('#produktbilder_target_MT').sortable( {
+ items: 'a',
+ helper : 'clone',
+ update: function(event, ui) {
+
+ //wpsg_vp_ajaxloading_show();
+
+ var wpsg_reorder = jQuery(this).sortable('toArray');
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=wpsg_setImageOrder&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+ async: false,
+ data: {
+ 'p_id': <?php echo '1'; ?>,
+ 'wpsg_reorder': wpsg_reorder
+ },
+ success: function(data) {
+
+ if (data != '1') alert(data);
+ //wpsg_vp_ajaxloading_hide();
+
+ }
+ } );
+
+ }
+ } ).disableSelection();
+
+
+ });
+
/*
jQuery(document).ready(function() {
@@ -155,7 +188,7 @@
}
- jQuery(document).ready(function() {
+ jQuery(document).ready(function() {
// Set all variables to be used in scope
var wpframe,
@@ -180,11 +213,44 @@
wpframe = wp.media.frames.file_frame = wp.media({
title: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
- multiple: false // Set to true to allow multiple files to be selected
+ multiple: true // Set to true to allow multiple files to be selected
});
// When an image is selected in the media frame...
wpframe.on( 'select', function() {
+
+ var attachments = wpframe.state().get('selection').map(
+ function( attachment ) {
+
+ attachment.toJSON();
+ return attachment;
+ });
+
+ //loop through the array and do things with each attachment
+ var i, attachment;
+ for (i = 0; i < attachments.length; ++i) {
+
+ attachment = attachments[i];
+ imgContainer.append( '<img src="'+attachment.url+'" alt="" style="max-width:100%;"/>' );
+
+ attachment = attachment.toJSON();
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=uploadmt&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+ async: true,
+ data: {
+ post: attachment
+ },
+ success: function(data) {
+
+ jQuery('#produktbilder_target_MT').html(data);
+
+ }
+ } );
+
+
+ }
+
+ /*
// Get media attachment details from the frame state
var attachment = wpframe.state().get('selection').first().toJSON();
// Send the attachment URL to our custom image input field.
@@ -214,29 +280,15 @@
}
} );
-
- });
+ */
+
+ }); // wpframe.on( 'select', function())
// Finally, open the modal on click
wpframe.open();
- });
+ }); // jQuery("#btnAddImgLink").click(function (event))
- // DELETE IMAGE LINK
- delImgLink.on( 'click', function( event ){
-
- event.preventDefault();
- // Clear out the preview image
- imgContainer.html( '' );
- // Un-hide the add image link
- addImgLink.removeClass( 'hidden' );
- // Hide the delete image link
- delImgLink.addClass( 'hidden' );
- // Delete the image id from the hidden input
- imgIdInput.val( '' );
-
- });
-
- });
+ }); // jQuery(document).ready(function())
/* ]]> */</script>
@@ -294,7 +346,7 @@
<?php } else { ?>
<p><?php echo __('Das Hochladen von Produktbildern ist erst nach erstmaligem speichern möglich.', 'wpsg'); ?></p>
- <?php } ?>
+ <?php } ?>
<div class="wpsg_clear"></div><br />
diff --git a/views/mods/mod_produktbilder/produkt_edit_list_MT.phtml b/views/mods/mod_produktbilder/produkt_edit_list_MT.phtml
index b7e701b..3589f68 100644
--- a/views/mods/mod_produktbilder/produkt_edit_list_MT.phtml
+++ b/views/mods/mod_produktbilder/produkt_edit_list_MT.phtml
@@ -10,9 +10,9 @@
<?php foreach ($this->view['ProduktBilder_MT'] as $b) { ?>
- <div class="wpsg_mod_produktbilder_admin_bild">
+ <div id="produktbild_div_<?php echo $b['pid']; ?>" class="wpsg_mod_produktbilder_admin_bild">
- <a onclick="return wpsg_remove_bild_MT('<?php echo $b['pid']; ?>');" href="#" title="<?php echo __('Dieses Bild löschen.', 'wpsg'); ?>">
+ <a id="produktbild_<?php echo $b['pid']; ?>" onclick="return wpsg_remove_bild_MT('<?php echo $b['pid']; ?>');" href="#" title="<?php echo __('Dieses Bild löschen.', 'wpsg'); ?>">
<img src="<?php echo $b['guid']; ?>" alt="<?php echo wpsg_hspc($b['fname']); ?>" />
<span><span class="glyphicon glyphicon-trash"></span></span>
</a>