Changeset 6088


Ignore:
Timestamp:
May 6, 2010, 10:40:05 PM (10 years ago)
Author:
ronosman
Message:

Feature 1609 added : Verify upload access while connecting and before upload.

Location:
extensions/pLoader/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/locale/fr_FR/pLoader.po

    r5472 r6088  
    703703msgid "Selection"
    704704msgstr "Sélection"
     705
     706msgid "Your user account is not granted to upload photos"
     707msgstr "Les droits associés à votre compte ne permettent pas le transfert de photos"
     708
     709msgid "Add photos for resizing and uploading"
     710msgstr "Ajoute des photos à redimensionner et transférer"
     711
     712msgid "Remove selected photos. Original files are not deleted"
     713msgstr "Enlève les photos sélectionnées. Les fichiers originaux ne sont pas supprimés"
     714
     715msgid "Change global settings"
     716msgstr "Change les réglages"
  • extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm

    r6087 r6088  
    16661666    my ( $self, $select_all ) = @_;
    16671667
     1668    return if wxTheApp->CheckUpload;
    16681669    return if !scalar @{$self->imagelist->sums};
    16691670
     
    18261827            1,
    18271828            wxTheApp->resource_path('tb_remove.png'),
    1828             gettext("Remove selected photos. Original files are not deleted ")
     1829            gettext("Remove selected photos. Original files are not deleted")
    18291830        ],
    18301831        [
     
    18351836            0,
    18361837            wxTheApp->resource_path('tb_settings.png'),
    1837             gettext("Change global settings.")
     1838            gettext("Change global settings")
    18381839        ],
    18391840   
  • extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm

    r6087 r6088  
    260260    # user pressed OK
    261261    if($not_exit){
    262         $self->StoreConnectionProperties;
    263         if( !$self->use_offline ){
     262        $self->StoreConnectionProperties;
     263        if( !$self->use_offline ){
    264264            while( $not_exit and !$self->_is_connected ){
    265                 $not_exit = $self->Login();
    266                 last if $self->use_offline;
     265                $not_exit = $self->Login();
     266                last if $self->use_offline;
    267267            }
    268         }
     268            $self->CheckUpload;
     269        }
    269270        $self->_init_imagelist;
    270271        $self->_init_thumbimagelist;
    271272        $self->_set_stored_layout;
    272         #$self->_init_frame;
    273     }
    274     #Wx::LogMessage("bin dir %s", $bin_dir);
     273    }
     274
    275275    $not_exit;
    276276}
     
    557557            $use_new_imagelist = 1 unless $self->imagelist_version eq $stored_imagelist->{imagelist_version};
    558558        }
     559        # make sure we really have
    559560        $use_new_imagelist = 1 unless defined $stored_imagelist;
    560561
    561                 if($use_new_imagelist){
     562        if($use_new_imagelist){
    562563            Wx::LogMessage(gettext("pLoader has to reset image cache."));
    563564            # and silently clean layout
     
    983984
    984985
     986sub CheckUpload {
     987    my ( $self ) = @_;
     988
     989    my $err_msg = $self->pwg->CheckUpload;
     990
     991    $err_msg = gettext("Your user account is not granted to upload photos") if
     992        'Access denied' eq $err_msg;
     993
     994    Wx::LogMessage("%s", $err_msg) if $err_msg;
     995
     996    $err_msg;
     997}
    9859981;
  • extensions/pLoader/trunk/src/Uploader/ImageList.pm

    r5472 r6088  
    15971597}
    15981598
     1599
     1600sub CheckUpload {
     1601    my ( $self ) = @_;
     1602
     1603    $self->pwg->CheckUpload;
     1604}
     1605
    159916061;
  • extensions/pLoader/trunk/src/Uploader/PWG.pm

    r5732 r6088  
    5656    }
    5757    else{
     58        $self->GetMethods;
    5859        $self->RefreshCategories;
    5960        $self->RefreshTags;
  • extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm

    r5977 r6088  
    4343           qry_list_categories
    4444           qry_add_categories
     45           qry_list_methods
    4546           qry_list_tags
     47           qry_check_upload
    4648           items
    4749           tags
     
    7173           multiple_value_mode
    7274           privacy_level
     75           is_method_available
    7376      /
    7477);
     
    145148        $self->urlbase,
    146149        'pwg.tags.getAdminList',
     150    );
     151
     152    $self->qry_list_methods( sprintf
     153        "%s/ws.php?format=json&method=%s",
     154        $self->urlbase,
     155        'reflection.getMethodList',
     156    );
     157
     158    $self->qry_check_upload( sprintf
     159        "%s/ws.php?format=json&method=%s",
     160        $self->urlbase,
     161        'pwg.images.checkUpload',
    147162    );
    148163
     
    193208        };
    194209    }
    195    
     210
     211    if(401 == $self->uagent_response->code){
     212        $hresult->{message} = 'Access denied';
     213    }
     214
    196215    $hresult;
    197216}
     
    237256    return ( $result->is_success, $result->status_line );
    238257}
     258
    239259sub GetCategories {
    240260    my ( $self ) = @_;
     
    268288}
    269289
     290sub CheckUpload {
     291    my ( $self ) = @_;
     292
     293    my $err_msg;
     294
     295    if($self->is_method_available->{'pwg.images.checkUpload'}){
     296        $self->_execute_get(
     297            $self->qry_check_upload
     298        );
     299#        my $result = $self->_json_response_content->{result};
     300        my $hresult = $self->_json_response_content;
     301
     302        $err_msg = 'ok' eq $hresult->{stat} ?
     303            $hresult->{result}{message} :
     304            $hresult->{message};
     305    }
     306
     307    $err_msg;
     308}
     309
     310sub GetMethods {
     311    my ( $self ) = @_;
     312
     313    $self->_execute_get(
     314        $self->qry_list_methods   
     315    );
     316
     317    my $methods = $self->_json_response_content->{result}{methods};
     318
     319    $self->is_method_available(
     320        {}
     321    );
     322
     323    map {
     324        $self->is_method_available->{$_}++
     325    }@$methods;
     326
     327    $methods;
     328}
    270329
    271330sub UploadImage {
Note: See TracChangeset for help on using the changeset viewer.