Changeset 3504 for extensions/pLoader


Ignore:
Timestamp:
Jul 3, 2009, 2:23:11 PM (15 years ago)
Author:
ronosman
Message:

Feature 1039 added. Feature 1040 added. Filter and add Piwigo tags.
The tag list is filtered based on user input ( tag beginning with same characters ) or tag status ( All, Selected, Not selected ).
When a search result is empty, user is asked for tag creation confirmation.
When a search result returns a single result, the user input is autocompleted and the tag is selected if user validates with Enter.

Location:
extensions/pLoader/trunk/src/Uploader
Files:
1 added
1 deleted
2 edited

Legend:

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

    r3472 r3504  
    2424use Wx::DND;
    2525use Wx qw/
     26             wxYES_NO
     27             wxYES
     28             wxICON_QUESTION
    2629             wxITEM_NORMAL
    2730             wxNullBitmap
     
    369372use Uploader::GUI::wxImageListCtrl;
    370373use Uploader::GUI::wxImageProcessingProgressDlg;
    371 use Uploader::GUI::wxChoiceGridPanel;
     374use Uploader::GUI::wxChoiceFilteredPanel;
    372375use Wx::Html;
    373376use Uploader::GUI::wxHtmlWindow;
     
    428431        sub { $self->UploadImagesViewerRefresh(@_) }
    429432    );
    430 
    431433
    432434
     
    718720
    719721    $self->image_tags(
    720         sub { $self->imagelist->current_image->site_tags(@_) }
     722        sub { eval { $self->imagelist->current_image->site_tags(@_) } }
    721723    );
    722724
    723725    $self->piwigo_tags(
    724         wxTheApp->pwg->tags||[]
     726        sub { wxTheApp->pwg->tags }
    725727    ); 
     728}
     729
     730sub _create_piwigo_tag {
     731    my ( $self, $name ) = @_;
     732   
     733    if(
     734        Wx::MessageBox(
     735            sprintf(
     736                gettext("Do you want to create \"%s\" ?"),
     737                $name,
     738            ),
     739            gettext("Piwigo search information"),
     740            wxYES_NO | wxICON_QUESTION,
     741        ) == wxYES
     742    ){   
     743        $self->pwg->AddTags($name);
     744        $self->pwg->RefreshTags;
     745    }
    726746}
    727747
     
    905925
    906926    $self->image_prop_tags(
    907         Uploader::GUI::wxChoiceGridPanel->new(
     927        Uploader::GUI::wxChoiceFilteredPanel->new(
    908928            {
    909929                parentwnd    => $self,
    910930                choices      => $self->piwigo_tags,
    911                 selection    => $self->image_tags,
     931                selection    => $self->image_tags,
     932                creation_callback => sub { $self->_create_piwigo_tag(@_) },
    912933            }
    913934        )   
  • extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm

    r3472 r3504  
    209209}
    210210
     211sub AddTags {
     212    my ( $self, $name ) = @_;
     213
     214    my $form = {
     215        method            => 'pwg.tags.add',
     216        name              => $name,
     217       
     218    };
     219
     220    my $result = $self->uagent->post(
     221        $self->urlbase.'/ws.php?format=json',
     222        $form
     223    );
     224
     225    my $content = {};
     226        eval {
     227            $content = from_json(
     228                $result->content
     229            );
     230        };
     231
     232    return ( $result->is_success, $result->status_line, $content );
     233       
     234}
     235
    211236
    212237sub UploadImage {
Note: See TracChangeset for help on using the changeset viewer.