Changeset 6726


Ignore:
Timestamp:
07/29/10 08:56:27 (10 years ago)
Author:
ronosman
Message:

Reupload option management.

Location:
extensions/pLoader/trunk/src/Uploader
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/App.pm

    r6707 r6726  
    612612    ); 
    613613 
    614     print Dumper $self->localized_msg; 
    615614 
    616615} 
     
    910909 
    911910    if($self->is_single_instance_running){ 
    912         printf("connect_to_single_instance_server\n"); 
     911        #printf("connect_to_single_instance_server\n"); 
    913912        $self->connect_to_single_instance_server; 
    914         printf("connected to single_instance_server\n"); 
     913        #printf("connected to single_instance_server\n"); 
    915914        return 0; 
    916915    } 
    917916    else{ 
    918         printf("start_single_instance_server\n"); 
     917        #printf("start_single_instance_server\n"); 
    919918        $self->start_single_instance_server; 
    920         printf("single_instance_server started\n"); 
     919        #printf("single_instance_server started\n"); 
    921920        return 1; 
    922921    } 
     
    13121311} 
    13131312 
     1313 
     1314sub check_existing { 
     1315    my ( $self, $all ) = @_; 
     1316 
     1317    my $check = $self->pwg->IsAlreadyUploaded( 
     1318        $self->images->selection_image_ids($all) 
     1319    ); 
     1320 
     1321    $self->images->set_pwg_id($check); 
     1322 
     1323    my $existing = [  
     1324        grep { $_ } values %$check 
     1325    ]; 
     1326 
     1327    scalar @$existing; 
     1328} 
    13141329 
    13151330sub init_transfer_batch_end_event_handler { 
  • extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm

    r6707 r6726  
    10731073            my ( $handler, $event ) = @_; 
    10741074            my $data = $event->GetData; 
    1075 printf("image_done_event %s\n", Dumper $data); 
    10761075            if($data->{preferences}{remove_uploaded_from_selection}){ 
    10771076                my $gr = $data->{global_rank}; 
     
    15551554    } 
    15561555 
     1556    # check if update/insert 
     1557    my $existing = wxTheApp->check_existing($all_images); 
     1558    $self->show_reupload_options if $existing; 
     1559 
     1560 
    15571561    wxTheApp->start_resize($all_images); 
     1562 
     1563} 
     1564 
     1565 
     1566sub show_reupload_options { 
     1567    my ( $self ) = @_; 
     1568 
     1569    Uploader::GUI::wxImageReuploadDlg->new( 
     1570        {  
     1571            title => gettext("Photo update management"), 
     1572            properties =>  
     1573            { 
     1574                $main::ID_REUPLOAD_ACTION_FILES =>  
     1575                { 
     1576                    selection=>sub {$self->preferences->reupload_action_files(@_)}, 
     1577                    label=>gettext("What shall we do with files? (thumbnail, resized, high resolution)"), 
     1578                    labels=>[ 
     1579                        gettext("nothing"), 
     1580                        gettext("replace"), 
     1581                    ], 
     1582                }, 
     1583                $main::ID_REUPLOAD_ACTION_PROPERTIES =>  
     1584                {  
     1585                    selection=>sub{$self->preferences->reupload_action_properties(@_)}, 
     1586                    label=>gettext("What shall we do with single value properties?(caption, comment, author, create date)"), 
     1587                    labels=>[ 
     1588                        gettext("nothing"), 
     1589                        gettext("fill if empty (only replace properties currently empty in Piwigo)"), 
     1590                        gettext("replace"), 
     1591                    ], 
     1592                }, 
     1593                $main::ID_REUPLOAD_ACTION_PROPERTIES_M => 
     1594                {  
     1595                    selection=>sub{$self->preferences->reupload_action_properties_m(@_)}, 
     1596                    label=>gettext("What shall we do with multiple values properties? (categories, tags)"), 
     1597                    labels=>[ 
     1598                        gettext("nothing"), 
     1599                        gettext("append (keep existing and add new)"), 
     1600                        gettext("replace"), 
     1601                    ], 
     1602                }, 
     1603                $main::ID_REUPLOAD_NOT_ASK =>  
     1604                {  
     1605                    value=>sub{$self->preferences->reupload_not_ask(@_)},  
     1606                    label=>gettext("Do not ask me again"), 
     1607                }, 
     1608                $main::ID_REUPLOAD_TEXT =>  
     1609                {  
     1610                    label=>gettext("A least one photo has already been added in the past."), 
     1611                }, 
     1612            }, 
     1613        }  
     1614    )->ShowModal(); 
    15581615 
    15591616} 
  • extensions/pLoader/trunk/src/Uploader/Image.pm

    r6525 r6726  
    4545    caption 
    4646    global_rank 
     47    pwg_image_id 
    4748/; 
    4849 
  • extensions/pLoader/trunk/src/Uploader/Images.pm

    r6707 r6726  
    269269sub _remove_selection { 
    270270    my ( $self, $list ) = @_; 
    271     printf("_remove_selection %s\n", Dumper $list); 
     271 
    272272    # the list is sorted, ascendant 
    273273    # we reverse it to have 
     
    547547    my ( $self, $preferences, $destination_category, $all ) = @_; 
    548548 
    549     my $image_id_list = $all ? 
    550         $self->ordered_image_ids : 
    551         [ 
    552             map { 
    553                 $self->ordered_image_ids->[$_] 
    554             }@{$self->selection} 
    555         ]; 
    556549 
    557550    $self->get_images_data( 
    558         $image_id_list, 
     551        $self->selection_image_ids($all), 
    559552        $preferences, 
    560553        $destination_category 
     
    562555} 
    563556 
     557 
     558sub selection_image_ids { 
     559    my ( $self, $all ) = @_; 
     560 
     561    $all ? 
     562    $self->ordered_image_ids : 
     563    [ 
     564        map { 
     565            $self->ordered_image_ids->[$_] 
     566        }@{$self->selection} 
     567    ]; 
     568} 
     569 
     570 
     571# set piwigo id for already uploaded images. 
     572sub set_pwg_id { 
     573    my ( $self, $pwg_ids ) = @_; 
     574 
     575    map { 
     576        $self->_images->{$_}->{pwg_image_id} = $pwg_ids->{$_}; 
     577    } @{$self->ordered_image_ids}; 
     578} 
    564579 
    565580my $add_rank = 0; 
  • extensions/pLoader/trunk/src/Uploader/Preferences.pm

    r6426 r6726  
    4747    reupload_action_properties 
    4848    reupload_action_properties_m 
     49    reupload_not_ask 
    4950    display_mode 
    5051    thumbnail_shape_square 
  • extensions/pLoader/trunk/src/Uploader/ResizeWorker.pm

    r6709 r6726  
    8181    ); 
    8282 
    83     $self->resize_image($image); 
    84     $self->process_high_image($image); 
    85     $self->thumbnail_image($image); 
     83    $image->{update_files} = defined $image->{pwg_image_id} ? 
     84        $image->{preferences}{reupload_action_files} : 
     85        1; 
     86 
     87    if($image->{update_files}){ 
     88        $self->resize_image($image); 
     89        $self->process_high_image($image); 
     90        $self->thumbnail_image($image); 
     91    } 
    8692 
    8793    $self->post_image_done_event($image); 
  • extensions/pLoader/trunk/src/Uploader/TransferWorker.pm

    r6707 r6726  
    164164    $self->post_image_progress_event($image); 
    165165 
    166     $self->update_image_files($image); 
    167     $self->post_image_progress_event($image); 
     166    if($image->{update_files}){ 
     167        $self->update_image_files($image); 
     168        $self->post_image_progress_event($image); 
     169    } 
    168170 
    169171    $self->update_image_properties($image); 
Note: See TracChangeset for help on using the changeset viewer.