Plugin Directory

Changeset 490054


Ignore:
Timestamp:
01/15/2012 12:47:46 AM (14 years ago)
Author:
aesqe
Message:

1.7.4-RC2

multiple editors
drag and drop upload

Location:
file-gallery
Files:
129 added
7 edited

Legend:

Unmodified
Added
Removed
  • file-gallery/trunk/css/file-gallery.css

    r486647 r490054  
    4545    border: 1px solid #EFEFEF;
    4646    padding: 0;
    47     margin: 0 0 10px 0;
     47    margin: 5px 0 10px 0;
    4848    clear: both;
    4949    position: relative;
     
    572572}
    573573
     574.no-attachments.uploader #fg_buttons
     575{
     576    width: 30px;
     577}
     578
    574579#fg_buttons input,
    575580#file_gallery_upload_media
     
    632637}
    633638
     639.no-attachments.uploader #file_gallery_upload_media
     640{
     641    margin-top: 3px;
     642}
     643
    634644#fg_buttons input:hover,
    635645#file_gallery_upload_media:hover
     
    709719    background-image: url(../images/famfamfam_silk/images.png);
    710720}
     721
    711722.no-attachments #file_gallery_copy_all,
    712723.no-attachments #file_gallery_refresh
     
    715726    margin-left: 3px;
    716727    margin-top: 9px;
     728}
     729
     730.no-attachments.uploader #file_gallery_copy_all,
     731.no-attachments.uploader #file_gallery_refresh
     732{
     733    margin-top: 3px;
    717734}
    718735
  • file-gallery/trunk/file-gallery.php

    r486647 r490054  
    33Plugin Name: File Gallery
    44Plugin URI: http://skyphe.org/code/wordpress/file-gallery/
    5 Version: 1.7.4-RC
     5Version: 1.7.4-RC2
    66Description: "File Gallery" extends WordPress' media (attachments) capabilities by adding a new gallery shortcode handler with templating support, a new interface for attachment handling when editing posts, and much more.
    77Author: Bruno "Aesqe" Babic
     
    3232 */
    3333
    34 define('FILE_GALLERY_VERSION', '1.7.4-RC');
     34define('FILE_GALLERY_VERSION', '1.7.4-RC2');
    3535define('FILE_GALLERY_DEFAULT_TEMPLATES', serialize( array('default', 'file-gallery', 'list', 'simple') ) );
    3636
     
    670670function file_gallery_upgrade()
    671671{
    672     if( $options = get_option('file_gallery') && version_compare( $options['version'], FILE_GALLERY_VERSION, '<') )
     672    $options = get_option('file_gallery');
     673   
     674    if( isset($options['version']) && version_compare( $options['version'], FILE_GALLERY_VERSION, '<') )
    673675        file_gallery_activate();
    674676}
  • file-gallery/trunk/includes/attachments.php

    r486647 r490054  
    653653       
    654654    // get '_wp_attached_file' value based on upload path
    655     if( false !== get_option('uploads_use_yearmonth_folders') )
     655    if( false != get_option('uploads_use_yearmonth_folders') )
    656656    {
    657657        $_file = explode('/', $_file);
     
    659659       
    660660        $_file = $_file[$c-3] . '/' . $_file[$c-2] . '/' . $_file[$c-1];
     661    }
     662    else
     663    {
     664        $_file = basename($file);
    661665    }
    662666   
  • file-gallery/trunk/includes/main-form.php

    r486647 r490054  
    9393                </p>
    9494               
     95                <p id="file_gallery_external_url_label">
     96                    <label for="file_gallery_external_url"><?php _e("external url", "file-gallery"); ?>:</label>
     97                    <input type="text" name="file_gallery_external_url" id="file_gallery_external_url" value="<?php echo $file_gallery_options["default_external_url"]; ?>" />
     98                </p>
     99               
    95100                <p id="file_gallery_linksize_label">
    96101                    <label for="file_gallery_linksize"><?php _e("linked image size", "file-gallery"); ?>:</label>
     
    119124                        <input type="text" name="file_gallery_linkrel_custom" id="file_gallery_linkrel_custom" value="" />
    120125                    </span>
    121                 </p>
    122                
    123                 <p id="file_gallery_external_url_label">
    124                     <label for="file_gallery_external_url"><?php _e("external url", "file-gallery"); ?>:</label>
    125                     <input type="text" name="file_gallery_external_url" id="file_gallery_external_url" value="<?php echo $file_gallery_options["default_external_url"]; ?>" />
    126126                </p>
    127127               
  • file-gallery/trunk/includes/media-upload.php

    r486647 r490054  
    1616            {
    1717                min-width: 0;
     18                height: auto;
     19            }
     20           
     21            #media-upload.started .max-upload-size,
     22            #media-upload.started .after-file-upload
     23            {
     24                display: none;
    1825            }
    1926           
    2027            #media-items
    2128            {
    22                 margin-top: 15px;
     29                margin-top: 1px;
    2330                width: 99%;
    2431            }
     
    2633            #media-upload-header,
    2734            .savebutton,
    28             h3.media-title
     35            h3.media-title,
     36            .toggle,
     37            .media-item.error a.dismiss,
     38            .media-item.error .progress
    2939            {
    3040                display: none !important;
     41            }
     42           
     43            .media-item img
     44            {
     45                display: inline-block !important;
     46            }
     47           
     48            .media-item.error
     49            {
     50                background: #F4E4E0;
    3151            }
    3252           
     
    4060            {
    4161                margin: 0;
     62            }
     63           
     64            #file_gallery_continue
     65            {
     66                float: left;
     67                font-weight: bold;
     68                margin-top: 20px;
     69                color: #D54E21;
    4270            }
    4371        </style>
     
    5381        ?>
    5482        <script type="text/javascript">
    55             var topWin = window.dialogArguments || opener || parent || top, file_gallery_plupload;
    56            
     83            var topWin = window.dialogArguments || opener || parent || top, file_gallery_upload_error = false;
     84
    5785            jQuery(document).ready(function()
    5886            {
    59                 uploader.bind("FilesAdded", function(up, files) {
    60                     jQuery(".drag-drop").slideUp(300);
     87                if( ! uploader.features.dragdrop )
     88                {
     89                    topWin.file_gallery.uploader_dragdrop = false;
     90                    return;
     91                }
     92               
     93                jQuery("#file_gallery_continue").live("click", function(e)
     94                {
     95                    e.preventDefault();
     96                    topWin.file_gallery.init( "UploadComplete" );
     97                    return false;
    6198                });
    6299               
    63                 uploader.bind("UploadComplete", function(up, files) {
    64                     topWin.file_gallery.init( "efreshed" );
     100                uploader.bind("FilesAdded", function(up, files)
     101                {
     102                    jQuery(".drag-drop").slideUp(300);
     103                    jQuery("#media-upload").addClass("started");
     104                });
     105               
     106                uploader.bind("FileUploaded", function(up, file, response)
     107                {
     108                    if( -1 < response.response.search(/error-div/))
     109                    {
     110                        jQuery(".media-item .error-div").parent().addClass("error");
     111                        file_gallery_upload_error = true;
     112                    }
     113                });
     114               
     115                uploader.bind("UploadComplete", function(up, files)
     116                {
     117                    if( false === file_gallery_upload_error )
     118                        topWin.file_gallery.init( "UploadComplete" );
     119                    else
     120                        jQuery("#media-items").after('<a href="#" id="file_gallery_continue"><?php _e('Continue', 'file-gallery'); ?></a>')
     121
     122                    topWin.file_gallery.upload_inside = false;
     123                    file_gallery_upload_error = false;
     124                });
     125               
     126                uploader.bind("Error", function(up, err)
     127                {
     128                    file_gallery_upload_error = true;
     129                    topWin.file_gallery.upload_handle_error(err, up);
    65130                });
    66131            });
  • file-gallery/trunk/js/file-gallery.js

    r486647 r490054  
    6565        tinymce_events_added : false,
    6666        refreshed : false,
     67        upload_inside : false,
     68        uploader_dragdrop : true,
     69
    6770
    6871       
     
    131134                    {
    132135                        if( 46 === e.keyCode && "keyup" == e.type && true === file_gallery.gallery_image_clicked[ed.id] )
    133                         {                   
     136                        {
    134137                            $("#file_gallery_uncheck_all").trigger("click");
    135138                            file_gallery.gallery_image_clicked[ed.id] = false;
    136139                        }
    137140                    });
     141
     142                    /*
     143                    // event fires
     144                    $(ed.contentDocument).bind("drop", function(e)
     145                    {
     146                        console.log(e);
     147                    });
     148                    */
    138149                }
    139150            });
     
    311322            var ed = file_gallery.tinymce_get_editor();
    312323
    313             if( false === file_gallery.gallery_image_clicked[ed.id] && false === force )
     324            if( "undefined" !== ed || (ed.id && false === file_gallery.gallery_image_clicked[ed.id] && false === force) )
    314325                return;
    315326
     
    360371                attachment_order = $("#data_collector_full").val();
    361372           
     373            $("#file_gallery").removeClass("uploader");
     374            $("#fg_container").css({ minHeight: 0 });
     375           
    362376            if( 0 === $("#file_gallery_response").length )
    363377                $("#file_gallery.postbox").prepend('<div id="file_gallery_response"></div>');
     
    375389                file_gallery.refreshed = true;
    376390                attachment_order = $("#file_gallery_attachments_sort").val();
     391            }
     392            else if( "UploadComplete" == response_message )
     393            {
     394                file_gallery.refreshed = true;
    377395            }
    378396           
     
    17541772
    17551773
    1756 
    1757     $("#fg_container").live("dragover", function(e)
    1758     {
    1759         if( 0 < $("#file_gallery_upload_area").length )
    1760         {
    1761             $("#file_gallery_upload_area").css({
    1762                 top: "5px",
    1763                 width: $("#file-gallery-content").width() + "px",
    1764                 height: $("#file-gallery-content").height() + "px",
    1765                 minHeight: "350px",
    1766                 backgroundImage: $("#file_gallery").css("backgroundImage")
    1767             });
    1768            
    1769             $(this).css({
    1770                 minHeight: "350px"
    1771             });
     1774   
     1775    /**
     1776     * thanks to http://stackoverflow.com/questions/7110353/html5-dragleave-fired-when-hovering-a-child-element
     1777     */
     1778    $('#file_gallery').live(
     1779    {
     1780        dragenter: function()
     1781        {
     1782            if( ! file_gallery.uploader_dragdrop )
     1783                return;
     1784           
     1785            if( 0 < $("#file_gallery_upload_area").length && false === file_gallery.upload_inside )
     1786            {
     1787                $("#file_gallery").addClass("uploader");
     1788                $("#fg_container").css({ minHeight: "350px" });
     1789
     1790                $("#file_gallery_upload_area").css({
     1791                    top: "5px",
     1792                    width: $("#file-gallery-content").width() + "px",
     1793                    height: $("#file-gallery-content").height() + "px",
     1794                    minHeight: "350px",
     1795                    backgroundImage: $("#file_gallery").css("backgroundImage")
     1796                });
     1797
     1798                file_gallery.upload_inside = true;
     1799            }
     1800        },
     1801       
     1802        dragleave: function(e)
     1803        {
     1804            if( ! file_gallery.uploader_dragdrop )
     1805                return;
     1806           
     1807            var related = e.relatedTarget,
     1808                inside = false;
     1809       
     1810            if( null === related ) // webkit
     1811                related = e.target;
     1812           
     1813            if( related !== this )
     1814            {
     1815                if( related )
     1816                    inside = jQuery.contains(this, related);
     1817            }
     1818            else
     1819            {
     1820                if( null === e.relatedTarget ) // webkit
     1821                    inside = false;
     1822            }
     1823           
     1824            if( ! inside && 0 < $("#file_gallery_upload_area").length && true === file_gallery.upload_inside )
     1825                file_gallery.hide_upload();
    17721826        }
    17731827    });
    1774 
    1775     $("#fg_container").live("dragleave drop", function(e)
    1776     {
    1777         if( 0 < $("#file_gallery_upload_area").length )
    1778             $("#file_gallery_upload_area").css({top: "-9999em"});
    1779     });
     1828   
     1829    file_gallery.hide_upload = function()
     1830    {
     1831        $("#file_gallery_upload_area").css({top: "-9999em"});
     1832        $("#fg_container").css({ minHeight: 0 });
     1833        $("#file_gallery").removeClass("uploader");
     1834       
     1835        file_gallery.upload_inside = false;
     1836    }
     1837   
     1838    file_gallery.upload_handle_error = function(error, uploader)
     1839    {
     1840       
     1841    }
    17801842
    17811843    $("#file_gallery_linkclass, #file_gallery_imageclass, #file_gallery_galleryclass, #file_gallery_mimetype, #file_gallery_limit, #file_gallery_offset, #file_gallery_external_url, #file_gallery_single_linkclass, #file_gallery_single_imageclass, #file_gallery_single_external_url, #fg_gallery_tags, #file_gallery_postid, #file_gallery_mimetype, #file_gallery_linkrel_custom").live('keypress keyup', function(e)
     
    19942056        if( "click" == e.type )
    19952057            file_gallery.send_to_editor( $(this).attr("id") );
    1996         else
    1997             file_gallery.tinymce_set_ie_bookmark();
     2058        /*else
     2059            file_gallery.tinymce_set_ie_bookmark();*/
    19982060    });
    19992061
  • file-gallery/trunk/readme.txt

    r486647 r490054  
    22Contributors: aesqe, azizur
    33Donate link: http://skyphe.org/donate/
    4 Tags: attachment, attachments, gallery, galleries, template, templates, shortcode, file, files, attach, detach, unattach, copy, media, tags, library, custom, custom fields, custom fields for attachments, attachment custom fields
     4Tags: attachment, attachments, gallery, galleries, template, templates, shortcode, file, files, attach, detach, unattach, copy, media, tags, library, custom, custom fields, custom fields for attachments, attachment custom fields, drag drop upload
    55Requires at least: 3.1
    6 Tested up to: 3.4-alpha-19704
     6Tested up to: 3.4-alpha-19719
    77Stable tag: 1.7.3
    88
     
    119119
    120120== Changelog ==
     121
     122= 1.7.4-RC2 =
     123* January 14th, 2012
     124* support for multiple editors
     125* drag and drop upload by dragging files onto File Gallery interface
     126* proper check for attachment copies on file deletion when not
     127  using year/month upload structure - thanks to Per Wiklander :)
    121128
    122129= 1.7.3 =
Note: See TracChangeset for help on using the changeset viewer.