Changeset 3466


Ignore:
Timestamp:
Jun 26, 2009, 4:43:50 PM (15 years ago)
Author:
ronosman
Message:

Feature 1036 added. Rename a category from category list.

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

Legend:

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

    r3458 r3466  
    896896                Categories => gettext("Albums"),
    897897                'Add new category' => gettext("Add new album"),
     898                'Category name' => gettext("Album name :"),
     899                'New category' => gettext("New album"),
    898900            }
    899901        );
     
    902904        $self->branding(
    903905            {
    904                 categorie  => gettext("categorie"),     
    905                 Categorie  => gettext("Categorie"),     
     906                category  => gettext("categorie"),     
     907                Category  => gettext("Categorie"),     
    906908                categories => gettext("categories"),   
    907909                Categories => gettext("Categories"),   
    908                 'Add new category' => gettext("Add new category"),     
     910                'Add new category' => gettext("Add new category"),
     911                'Category name' => gettext("Category name :"),
     912                'New category' => gettext("New category"),
    909913            }
    910914        );
  • extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm

    r3461 r3466  
    6060             wxTR_HIDE_ROOT
    6161             wxTR_HAS_BUTTONS
     62             wxTR_EDIT_LABELS
    6263             wxMAXIMIZE
    6364             wxOK
     
    350351          EVT_MENU
    351352          EVT_TREE_SEL_CHANGED
     353          EVT_TREE_END_LABEL_EDIT
    352354          EVT_CLOSE
    353355          EVT_LIST_END_LABEL_EDIT
     
    11851187           wxBORDER_NONE|
    11861188           wxCLIP_CHILDREN|
    1187 #           wxTR_MULTIPLE|
    1188 #           wxTR_EXTENDED|
    1189            wxTR_HAS_BUTTONS
    1190 #           wxTR_HIDE_ROOT   
     1189           wxTR_HAS_BUTTONS|
     1190           wxTR_EDIT_LABELS
    11911191        )
    11921192    );
     
    14111411    EVT_TREE_SEL_CHANGED( $self, $self->tree, \&OnTreeSelChanged );
    14121412    EVT_TREE_ITEM_RIGHT_CLICK( $self, $self->tree, \&OnTreeItemRightClick );
     1413    EVT_TREE_END_LABEL_EDIT( $self, $self->tree, \&OnTreeEndLabelEdit );
    14131414
    14141415    EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \&OnImageViewerEndLabelEdit );
     
    15431544}
    15441545
     1546sub OnTreeEndLabelEdit {
     1547    my( $self, $event ) = @_;
     1548
     1549
     1550    my $category = $self->tree->GetPlData($event->GetItem);
     1551    my $category_id;
     1552   
     1553    $category_id = $category->{id} if 'HASH' eq ref($category) ;
     1554    my $comment;
     1555    my ( $success, $status_msg, $content ) = $self->pwg->SetInfoCategories( $event->GetLabel, $comment, $category_id);
     1556
     1557    my $ok = 1;
     1558   
     1559    if(!$success){
     1560        $ok = 0;
     1561    }
     1562
     1563    if('fail' eq $content->{stat}){
     1564        $ok = 0;
     1565    }
     1566
     1567    # method call failed
     1568    if(!$ok){
     1569        $event->Veto;
     1570        Wx::MessageBox(
     1571            sprintf(
     1572                "%s %s",
     1573                gettext("Update failed : "),
     1574                $status_msg
     1575            ),
     1576            gettext("Piwigo update error"),
     1577            wxOK | wxICON_EXCLAMATION,
     1578        );
     1579        Wx::LogMessage("%s\n\n%s", Dumper($content), gettext("This function is not available. A Piwigo upgrade may resolve this issue."));
     1580    }
     1581}
    15451582
    15461583sub OnImageViewerItemRightClick {
     
    15811618    my $dialog = Wx::TextEntryDialog->new(
    15821619        $self,
    1583         sprintf("%s name :", wxTheApp->branding->{Category}),
    1584         sprintf("Add new %s", wxTheApp->branding->{category}),
    1585         sprintf("New %s", wxTheApp->branding->{category}),
     1620        wxTheApp->branding->{'Category name'},
     1621        wxTheApp->branding->{'Add new category'},
     1622        wxTheApp->branding->{'New category'},
    15861623    );
    15871624
  • extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm

    r3451 r3466  
    328328}
    329329
     330sub SetInfoCategories{
     331    my ( $self, $name, $comment, $parentid ) = @_;
     332
     333    my $form = {
     334        method            => 'pwg.categories.setInfo',
     335        name              => $name,
     336        comment           => $comment,
     337        category_id       => $parentid,
     338       
     339    };
     340
     341    my $result = $self->uagent->post(
     342        $self->urlbase.'/ws.php?format=json',
     343        $form
     344    );
     345
     346    my $content = {};
     347        eval {
     348            $content = from_json(
     349                $result->content
     350            );
     351        };
     352
     353    return ( $result->is_success, $result->status_line, $content );
     354       
     355}
     356
    330357
    331358sub send_chunks {
Note: See TracChangeset for help on using the changeset viewer.