diff options
| author | hartmut <noreply@maennchen1.de> | 2017-03-02 10:26:36 +0000 |
|---|---|---|
| committer | hartmut <noreply@maennchen1.de> | 2017-03-02 10:26:36 +0000 |
| commit | 4088aa3cabf3ccf35389576282dcb349bcc5d2ea (patch) | |
| tree | d5ac76b73d8828d9249e17964b2fdbaa876bba7e | |
| parent | 35447c55b4985ab10d54ef4b85c415ef49882f8a (diff) | |
Integration Mediathek, Frontend Adressen aufsplitten
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@6091 0d5edaf7-2b12-4e95-93f4-047927463d4b
| -rw-r--r-- | views/mods/mod_produktbilder/produkt_addedit_content.phtml | 188 | ||||
| -rw-r--r-- | views/mods/mod_produktbilder/produkt_edit_list2.phtml | 28 |
2 files changed, 216 insertions, 0 deletions
diff --git a/views/mods/mod_produktbilder/produkt_addedit_content.phtml b/views/mods/mod_produktbilder/produkt_addedit_content.phtml index 31f2350..bc4cabd 100644 --- a/views/mods/mod_produktbilder/produkt_addedit_content.phtml +++ b/views/mods/mod_produktbilder/produkt_addedit_content.phtml @@ -25,6 +25,27 @@ </div>
</div>
+<div class="modal fade" tabindex="-1" role="dialog" id="wpsg_produktbilder_remove">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title"><?php echo __('Produktbild löschen', 'wpsg'); ?></h4>
+ </div>
+ <div class="modal-body">
+
+ <?php echo wpsg_drawForm_Checkbox('dialog_produktbilder_delmt', __('Auch in der Mediathek löschen', 'wpsg'), false, array()); ?>
+ <?php echo wpsg_drawForm_Checkbox('dialog_produktbilder_del', __('Produktzuordnung löschen', 'wpsg'), false, array()); ?>
+
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Abbrechen', 'wpsg'); ?></button>
+ <button type="button" class="btn btn-primary" onclick="return wpsg_remove_bild2OK();"><?php echo __('Löschen', 'wpsg'); ?></button>
+ </div>
+ </div>
+ </div>
+</div>
+
<div class="panel panel-default">
<div class="panel-heading clearfix">
@@ -148,6 +169,173 @@ <?php } ?>
<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_produktbilder"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Konfiguration der Produktbilder', 'wpsg'); ?></a>
+
+ <!-- Mediathek -->
+ <hr>
+ <div id="produktbilder_target2"><?php echo $this->view['ProduktList2']; ?></div>
+
+ <input value="WPmedia" class="button" type="text" style="text-align:center;" size="10" id="btnAddImgLink" />
+ <input value="Upload2" class="button" type="text" style="text-align:center;" size="10" id="upload_button2" />
+
+ <script type="text/javascript">/* <![CDATA[ */
+ jQuery(document).ready(function() {
+ new AjaxUpload(
+ "upload_button2", {
+ action: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=upload2&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1",
+ onSubmit: function(file, extension) {
+
+ jQuery('#produktbilder_target2').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ },
+ onComplete: function(file, response) {
+
+ //alert('onComplete=' + response);
+ if (response == '1')
+ {
+
+ jQuery("#produktbilder_target2").load("<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=produktbilder_liste2&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1");
+
+ //jQuery('#produktbilder_target2').html(data);
+ //if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
+
+ }
+ else
+ {
+ alert(response);
+ }
+
+ }
+ }
+ );
+ });
+
+ var post_id;
+ /**
+ * Wird beim löschen eines Bilds (anklicken) aufgerufen
+ */
+ function wpsg_remove_bild2(pid) {
+
+ post_id = pid;
+ //jQuery('#wpsg_produktbilder_remove').show();
+ jQuery('#wpsg_produktbilder_remove').modal( { } );
+ //jQuery('#wpsg_produktbilder_remove').modal('hide');
+
+ }
+
+ function wpsg_remove_bild2OK() {
+
+ delmt = jQuery('#dialog_produktbilder_delmt').is(':checked');
+ del = jQuery('#dialog_produktbilder_del').is(':checked');
+
+ jQuery('#wpsg_produktbilder_remove').modal('hide');
+
+ jQuery('#produktbilder_target2').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=remove2&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+ async: true,
+ data: {
+ del: del,
+ delmt: delmt,
+ pid: post_id
+ },
+ success: function(data) {
+
+ jQuery('#produktbilder_target2').html(data);
+
+ //if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
+
+ }
+ } );
+
+ return false;
+
+ }
+
+ jQuery(document).ready(function() {
+
+ // Set all variables to be used in scope
+ var wpframe,
+ metaBox = jQuery('#meta-box-id.postbox'), // Your meta box id here
+ addImgLink = metaBox.find('.upload-custom-img'),
+ delImgLink = metaBox.find( '.delete-custom-img'),
+ imgContainer = metaBox.find( '.custom-img-container'),
+ imgIdInput = metaBox.find( '.custom-img-id' );
+
+ // ADD IMAGE LINK
+ jQuery("#btnAddImgLink").click(function (event) {
+
+ event.preventDefault();
+
+ // If the media frame already exists, reopen it.
+ if ( wpframe ) {
+ wpframe.open();
+ return;
+ }
+
+ // Create a new media frame
+ 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
+ });
+
+ // When an image is selected in the media frame...
+ wpframe.on( 'select', function() {
+ // 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.
+ imgContainer.append( '<img src="'+attachment.url+'" alt="" style="max-width:100%;"/>' );
+ // Send the attachment id to our hidden input
+ imgIdInput.val( attachment.id );
+ // Hide the add image link
+ addImgLink.addClass( 'hidden' );
+ // Unhide the remove image link
+ delImgLink.removeClass( 'hidden' );
+
+ //URL -->
+ //Titel --> attachment.title --> wp_posts.post_title
+ //Beschriftung --> attachment.caption --> wp_posts.post_excerpt
+ //Alternativtext --> attachment.title --> wp_postmeta._wp_attachment_image_alt
+ //Beschreibung --> attachment.desription --> wp_posts.post_content
+
+ 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_target2').html(data);
+
+ }
+ } );
+
+ });
+
+ // Finally, open the modal on click
+ wpframe.open();
+ });
+
+ // 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( '' );
+
+ });
+
+ });
+
+ /* ]]> */</script>
</div>
</div>
\ No newline at end of file diff --git a/views/mods/mod_produktbilder/produkt_edit_list2.phtml b/views/mods/mod_produktbilder/produkt_edit_list2.phtml new file mode 100644 index 0000000..39fcf81 --- /dev/null +++ b/views/mods/mod_produktbilder/produkt_edit_list2.phtml @@ -0,0 +1,28 @@ +<?php
+
+ /**
+ * Template für die Liste der Bilder eines Produkts
+ */
+
+?>
+
+ <?php if (isset($this->view['ProduktBilder2']) && (sizeof($this->view['ProduktBilder2']) > 0)) { ?>
+
+ <?php foreach ($this->view['ProduktBilder2'] as $b) { ?>
+
+ <div class="wpsg_mod_produktbilder_admin_bild">
+
+ <a onclick="return wpsg_remove_bild2('<?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>
+
+ </div>
+
+ <?php } ?>
+ <div class="wpsg_clear"></div>
+
+ <?php } else { ?>
+ <p><?php echo __('Bisher keine Produktbilder hochgeladen.', 'wpsg'); ?></p>
+ <?php } ?>
+
|
