Changeset 6426 for extensions/pLoader
- Timestamp:
- May 31, 2010, 9:35:46 AM (14 years ago)
- Location:
- extensions/pLoader/trunk/src
- Files:
-
- 12 added
- 4 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
r5566 r6426 273 273 # change the property value. 274 274 $self->properties->{$id}->{id_selection}->( 275 $event->GetEventObject-> GetSelectionsIds275 $event->GetEventObject->selection_ids 276 276 ) if exists $self->properties->{$id}->{id_selection}; 277 277 … … 327 327 map { 328 328 my $ctrl =$self->FindWindow($_)||$self->{$_}; 329 #printf("ctrl %s : %s\n", $_, $ctrl);330 329 if(defined $ctrl){ 331 330 # checkbox, static text -
extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm
r6094 r6426 76 76 wxBOLD 77 77 wxALIGN_CENTER 78 wxUSER_ATTENTION_INFO 78 79 /; 79 80 use base qw/Wx::Frame Class::Accessor::Fast/; … … 82 83 use POSIX qw(ceil floor); 83 84 84 require Win32 if($^O =~ /MSWin32/); 85 86 87 88 my @properties = 89 qw/ 90 progressdlg 91 upload_progressdlg 92 imageviewer 93 imageviewer_img 94 tree 95 tree_root 96 treeimglist 97 tree_item_default 98 pwg 99 logwnd 100 oldlogwnd 101 categories 102 imagelist 103 image_preview_dlg 104 image_prop_piwigo 105 exif_dlg 106 image_prop_tags 107 global_settings_dlg 108 piwigo_property_list 109 exif_properties 110 global_settings 111 toolbar 112 branding 113 current_imageviewer_index 114 imageviewer_mnu 115 tree_mnu 116 imageviewer_select_multi 117 frameLayout 118 piwigo_tags 119 image_tags 120 piwigo_photo_properties 121 piwigo_photo_properties_dlg 122 piwigo_photo_properties_tags 123 image_preview_need_refresh 124 imageviewer_refresh 125 imageviewer_item_refresh 126 horizontal_splitter 127 destination_category_dlg 128 destination_categories 129 categories_treectrl 130 /; 85 86 my @properties = qw/ 87 images 88 preferences 89 upload_progressdlg 90 image_progress_columns 91 image_progress_event 92 imageviewer 93 imageviewer_img 94 tree 95 tree_root 96 treeimglist 97 tree_item_default 98 pwg 99 logwnd 100 oldlogwnd 101 image_preview_dlg 102 image_prop_piwigo 103 exif_dlg 104 image_prop_tags 105 preferences_dlg 106 piwigo_property_list 107 exif_properties 108 preferences_properties 109 toolbar 110 branding 111 current_imageviewer_index 112 imageviewer_mnu 113 tree_mnu 114 imageviewer_select_multi 115 frameLayout 116 piwigo_tags 117 image_tags 118 piwigo_photo_properties 119 piwigo_photo_properties_dlg 120 piwigo_photo_properties_tags 121 image_preview_need_refresh 122 imageviewer_refresh 123 imageviewer_item_refresh 124 horizontal_splitter 125 destination_category_dlg 126 destination_categories 127 categories_treectrl 128 /; 131 129 __PACKAGE__->mk_accessors( @properties ); 132 130 … … 134 132 use Uploader::GUI::wxImageListCtrl; 135 133 use Uploader::GUI::wxPropertyListDlg; 136 use Uploader::GUI:: wxGlobalSettings;134 use Uploader::GUI::Preferences; 137 135 use Uploader::GUI::wxImagePreview; 138 136 use Uploader::GUI::wxPhotoProperties; 139 137 use Uploader::GUI::wxImageReuploadDlg; 140 use Uploader::GUI:: wxImageProcessingProgressDlg;138 use Uploader::GUI::ImageProgressDlg; 141 139 use Uploader::GUI::wxDestinationCategoryDlg; 142 140 use Uploader::GUI::wxCategoryTreeCtrl; … … 160 158 ); 161 159 162 163 160 $self->pwg( $params->{pwg} ); 164 $self->imagelist( $params->{imagelist} ); 165 166 167 $self->imagelist->pwg( 168 $self->pwg 169 ); 170 171 $self->imagelist->categories( 172 [] 173 ); 161 $self->images( $params->{images} ); 162 $self->preferences( $params->{preferences} ); 174 163 175 164 … … 181 170 $self->init_image_types; 182 171 183 $self->imageviewer-> SelectItem(172 $self->imageviewer->select_item( 184 173 $self->current_imageviewer_index 185 174 ) if $self->imageviewer->GetItemCount; … … 187 176 # if file in command line parameters, try to load 188 177 my $files = wxTheApp->argv; 189 $self-> SetNewFiles($files) if scalar @$files;178 $self->add_images($files) if scalar @$files; 190 179 191 180 $self->Show; … … 198 187 199 188 # callback for GUI refresh : add thumbnail images to the imageviewer control 200 $self->imagelist->SetNewFilesViewerRefreshCallback( 201 sub { $self->SetNewFilesViewerRefresh(@_) } 202 ); 203 204 # callback for GUI refresh : progress dialog display of thumbnail image being created 205 $self->imagelist->SetNewFilesProgressCallback( 206 sub { $self->SetNewFilesProgress(@_) } 207 ); 208 209 $self->imagelist->SetNewFilesDisplayEndInfoCallback( 210 sub { $self->SetNewFilesDisplayEndInfo(@_) } 211 ); 212 213 # callback for GUI refresh : remove thumbnail images from imageviewer control 214 $self->imagelist->UploadImagesViewerCallback( 215 sub { $self->UploadImagesViewerRefresh(@_) } 216 ); 217 218 $self->imagelist->ReuploadCallback( 219 sub 220 { 221 Uploader::GUI::wxImageReuploadDlg->new( 222 { 223 title => gettext("Photo update management"), 224 properties => 225 { 226 $main::ID_REUPLOAD_ACTION_FILES => 227 { 228 selection=>sub {$self->imagelist->reupload_action_files(@_)}, 229 label=>gettext("What shall we do with files? (thumbnail, resized, high resolution)"), 230 labels=>[ 231 gettext("nothing"), 232 gettext("replace"), 233 ], 234 }, 235 $main::ID_REUPLOAD_ACTION_PROPERTIES => 236 { 237 selection=>sub{$self->imagelist->reupload_action_properties(@_)}, 238 label=>gettext("What shall we do with single value properties?(caption, comment, author, create date)"), 239 labels=>[ 240 gettext("nothing"), 241 gettext("fill if empty (only replace properties currently empty in Piwigo)"), 242 gettext("replace"), 243 ], 244 }, 245 $main::ID_REUPLOAD_ACTION_PROPERTIES_M => 246 { 247 selection=>sub{$self->imagelist->reupload_action_properties_m(@_)}, 248 label=>gettext("What shall we do with multiple values properties? (categories, tags)"), 249 labels=>[ 250 gettext("nothing"), 251 gettext("append (keep existing and add new)"), 252 gettext("replace"), 253 ], 254 }, 255 $main::ID_REUPLOAD_NOT_ASK => 256 { 257 value=>sub{$self->imagelist->reupload_not_ask(@_)}, 258 label=>gettext("Do not ask me again"), 259 }, 260 $main::ID_REUPLOAD_TEXT => 261 { 262 label=>gettext("A least one photo has already been added in the past."), 263 }, 264 }, 265 } )->ShowModal();} 266 ); 267 268 269 # callback for GUI refresh : progress dialog display current uploaded image 270 $self->imagelist->progress_thumbnail_refresh( 271 sub { $self->UploadProgressThumbnailRefresh(@_) } 272 ); 273 274 $self->imagelist->progress_msg_refresh( 275 sub { $self->UploadProgressMessageRefresh(@_) } 276 ); 277 278 $self->imagelist->progress_msg_details_refresh( 279 sub { $self->UploadProgressMessageDetailsRefresh(@_) } 280 ); 281 282 $self->imagelist->progressbar_refresh( 283 sub { $self->UploadProgressBarRefresh(@_) } 284 ); 285 286 $self->imagelist->progress_endinfo_refresh( 287 sub { $self->UploadDisplayEndInfo(@_) } 288 ); 189 $self->images->add_images_cbk( 190 sub { $self->add_images_viewer_refresh(@_) } 191 ); 192 193 $self->images->delete_images_cbk( 194 sub { $self->delete_images_viewer_refresh(@_) } 195 ); 196 197 289 198 } 290 199 … … 300 209 string_selection => sub { return 1; }, 301 210 value => sub { 302 $self->image list->SetImageSelectionName(@_);211 $self->images->set_image_selection_name(@_); 303 212 $self->multi_selection_mode ? 304 $self->image list->image_selection_name :305 $self->image list->current_image->site_name;213 $self->images->selection_name : 214 $self->images->current_image->site_name; 306 215 }, 307 pre_process => sub { sub { $self->image list->GetCurrentImageCaption(@_); } },216 pre_process => sub { sub { $self->images->get_current_image_caption(@_); } }, 308 217 choices => 309 218 [ … … 316 225 value => sub { 317 226 $self->multi_selection_mode ? 318 $self->image list->SetImageSelectionComment(@_):319 $self->image list->current_image->site_comment(@_)227 $self->images->set_image_selection_comment(@_): 228 $self->images->current_image->site_comment(@_) 320 229 }, 321 230 frame_callback => sub { $self->imageviewer_item_refresh(1); }, … … 325 234 value => sub { 326 235 $self->multi_selection_mode ? 327 $self->image list->SetImageSelectionAuthor(@_):328 $self->image list->current_image->site_author(@_)236 $self->images->set_image_selection_author(@_): 237 $self->images->current_image->site_author(@_) 329 238 }, 330 239 frame_callback => sub { $self->imageviewer_item_refresh(1); }, … … 335 244 value => sub { 336 245 $self->multi_selection_mode ? 337 $self->image list->SetImageSelectionCreateDate(@_):338 $self->image list->current_image->create_date(@_)246 $self->images->set_image_selection_create_date(@_): 247 $self->images->current_image->create_date(@_) 339 248 }, 340 249 frame_callback => sub { $self->imageviewer_item_refresh(1); }, … … 344 253 selection => sub { 345 254 $self->multi_selection_mode ? 346 $self->image list->SetImageSelectionPrivacyLevel(@_):347 $self->image list->current_image->privacy_level(@_)255 $self->images->set_image_selection_privacy_level(@_): 256 $self->images->current_image->privacy_level(@_) 348 257 }, 349 258 choices => wxTheApp->privacy_level_choices, … … 359 268 ); 360 269 361 $self-> global_settings(270 $self->preferences_properties( 362 271 { 363 272 $main::DEFAULT_PHOTO_CAPTION => { label => gettext("Default caption pattern") }, … … 370 279 $main::GS_CLOSE => { label => gettext("Close")}, 371 280 $main::GS_THUMBNAIL_SHAPE => { 372 selection => sub { $self-> imagelist->thumbnail_shape_square(@_) },281 selection => sub { $self->preferences->thumbnail_shape_square(@_) }, 373 282 choices => 374 283 [ … … 377 286 }, 378 287 $main::GS_DEFAULT_PHOTO_CAPTION => { 379 string_selection => sub { $self-> imagelist->default_caption_pattern(@_) },288 string_selection => sub { $self->preferences->default_caption_pattern(@_) }, 380 289 choices => 381 290 [ … … 390 299 $main::PHOTO_CAPTION_PREFIX => { label => gettext("Default caption") }, 391 300 $main::GS_PHOTO_CAPTION_PREFIX => { 392 value => sub { $self-> imagelist->default_caption(@_) },301 value => sub { $self->preferences->default_caption(@_) }, 393 302 }, 394 303 $main::GS_AUTO_ROTATE => { 395 304 label => gettext("Auto rotate image"), 396 value => sub { $self-> imagelist->auto_rotate(@_) }305 value => sub { $self->preferences->auto_rotate(@_) } 397 306 }, 398 307 $main::DEFAULT_AUTHOR => { label => gettext("Default author")}, 399 $main::GS_DEFAULT_AUTHOR => { value => sub { $self-> imagelist->author(@_) } },308 $main::GS_DEFAULT_AUTHOR => { value => sub { $self->preferences->author(@_) } }, 400 309 $main::THUMBNAIL_SIZE => { label => gettext("Site thumbnail size") }, 401 310 $main::GS_THUMBNAIL_SIZE => { 402 value => sub { $self-> imagelist->thumb_size(@_) },311 value => sub { $self->preferences->thumb_size(@_) }, 403 312 validator => Wx::Perl::TextValidator->new( '\d' ) 404 313 }, 405 314 $main::THUMBNAIL_JPEG_QUALITY => { label => gettext("Site thumbnail jpeg quality") }, 406 315 $main::GS_THUMBNAIL_JPEG_QUALITY => { 407 value => sub { $self-> imagelist->th_quality(@_) },316 value => sub { $self->preferences->th_quality(@_) }, 408 317 validator => Wx::Perl::TextValidator->new( '\d' ) 409 318 }, 410 319 $main::GS_CREATE_RESIZED => { 411 selection => sub { $self-> imagelist->create_resized(@_) },320 selection => sub { $self->preferences->create_resized(@_) }, 412 321 choices => 413 322 [ … … 421 330 $main::SITE_IMG_WIDTH => { label => gettext("Maximum width") }, 422 331 $main::GS_SITE_IMG_WIDTH => { 423 value => sub { $self-> imagelist->resize_w(@_) },332 value => sub { $self->preferences->resize_w(@_) }, 424 333 validator => Wx::Perl::TextValidator->new( '\d' ) 425 334 }, 426 335 $main::SITE_IMG_HEIGHT => { label => gettext("Maximum height") }, 427 336 $main::GS_SITE_IMG_HEIGHT => { 428 value => sub { $self-> imagelist->resize_h(@_) },337 value => sub { $self->preferences->resize_h(@_) }, 429 338 validator => Wx::Perl::TextValidator->new( '\d' ) 430 339 }, 431 340 $main::SITE_IMG_JPEG_QUALITY => { label => gettext("Site image jpeg quality") }, 432 341 $main::GS_SITE_IMG_JPEG_QUALITY => { 433 value => sub { $self-> imagelist->quality(@_) },342 value => sub { $self->preferences->quality(@_) }, 434 343 validator => Wx::Perl::TextValidator->new( '\d' ) 435 344 }, 436 345 $main::SITE_IMG_FILTER => { label => gettext("Site image filter") }, 437 346 $main::GS_SITE_IMG_FILTER => { 438 string_selection => sub { $self-> imagelist->filter(@_) },347 string_selection => sub { $self->preferences->filter(@_) }, 439 348 choices => 440 349 [ … … 444 353 $main::SITE_IMG_BLUR => { label => gettext("Site image blur") }, 445 354 $main::GS_SITE_IMG_BLUR => { 446 value => sub { $self-> imagelist->blur(@_) },355 value => sub { $self->preferences->blur(@_) }, 447 356 validator => Wx::Perl::TextValidator->new( '\d' ) 448 357 }, 449 358 $main::SITE_IMG_INTERLACE => { label => gettext("Site image interlace") }, 450 359 $main::GS_SITE_IMG_INTERLACE => { 451 string_selection => sub { $self-> imagelist->interlace(@_) },360 string_selection => sub { $self->preferences->interlace(@_) }, 452 361 choices => 453 362 [ … … 457 366 $main::GS_REMOVE_UPLOADED_FROM_SELECTION => { 458 367 label => gettext("Remove uploaded photo from selection"), 459 value => sub { $self-> imagelist->remove_uploaded_from_selection(@_) },368 value => sub { $self->preferences->remove_uploaded_from_selection(@_) }, 460 369 }, 461 370 $main::GS_HD_UPLOAD => { … … 465 374 ], 466 375 pre_process => sub { my ( $value ) = @_; wxTheApp->eng_upload_hd->{$value} }, 467 string_selection => sub { $self-> imagelist->upload_hd(@_) },376 string_selection => sub { $self->preferences->upload_hd(@_) }, 468 377 frame_callback => sub { 469 378 my( $self, $ctrl, $event ) = @_; … … 474 383 $main::GS_HD_IMG_WIDTH => { 475 384 label => gettext("HD image width"), 476 value => sub { $self-> imagelist->hd_w(@_) },385 value => sub { $self->preferences->hd_w(@_) }, 477 386 validator => Wx::Perl::TextValidator->new( '\d' ) 478 387 }, … … 480 389 $main::GS_HD_IMG_HEIGHT => { 481 390 label => gettext("HD image height"), 482 value => sub { $self-> imagelist->hd_h(@_) },391 value => sub { $self->preferences->hd_h(@_) }, 483 392 validator => Wx::Perl::TextValidator->new( '\d' ) 484 393 }, 485 394 $main::HD_IMG_JPEG_QUALITY => { label => gettext("HD image jpeg quality") }, 486 395 $main::GS_HD_IMG_JPEG_QUALITY => { 487 value => sub { $self-> imagelist->hd_quality(@_) },396 value => sub { $self->preferences->hd_quality(@_) }, 488 397 validator => Wx::Perl::TextValidator->new( '\d' ) 489 398 }, 490 399 $main::HD_IMG_FILTER => { label => gettext("HD image filter") }, 491 400 $main::GS_HD_IMG_FILTER => { 492 string_selection => sub { $self-> imagelist->hd_filter(@_) },401 string_selection => sub { $self->preferences->hd_filter(@_) }, 493 402 choices => 494 403 [ … … 498 407 $main::HD_IMG_BLUR => { label => gettext("HD image blur") }, 499 408 $main::GS_HD_IMG_BLUR => { 500 value => sub { $self-> imagelist->hd_blur(@_) },409 value => sub { $self->preferences->hd_blur(@_) }, 501 410 validator => Wx::Perl::TextValidator->new( '\d' ) 502 411 }, 503 412 $main::HD_IMG_INTERLACE => { label => gettext("HD image interlace") }, 504 413 $main::GS_HD_IMG_INTERLACE => { 505 string_selection => sub { $self-> imagelist->hd_interlace(@_) },414 string_selection => sub { $self->preferences->hd_interlace(@_) }, 506 415 choices => 507 416 [ … … 511 420 $main::GS_WMARK_ACTIVATE => { 512 421 label => gettext("Activate watermark"), 513 value => sub { $self-> imagelist->watermark_activate(@_) },422 value => sub { $self->preferences->watermark_activate(@_) }, 514 423 frame_callback => sub { 515 424 my( $self, $ctrl, $event ) = @_; … … 519 428 $main::GS_WMARK_ACTIVATE_HD => { 520 429 label => gettext("Activate watermark on high definition"), 521 value => sub { $self-> imagelist->watermark_activate_pwg_high(@_) },430 value => sub { $self->preferences->watermark_activate_pwg_high(@_) }, 522 431 frame_callback => sub { 523 432 my( $self, $ctrl, $event ) = @_; … … 527 436 $main::WMARK_TEXT => { label => gettext("Text") }, 528 437 $main::GS_WMARK_TEXT => { 529 value => sub { $self-> imagelist->watermark_text(@_) },438 value => sub { $self->preferences->watermark_text(@_) }, 530 439 }, 531 440 $main::WMARK_TEXT_SIZE => { label => gettext("Text size") }, 532 441 $main::GS_WMARK_TEXT_SIZE => { 533 value => sub { $self-> imagelist->watermark_text_size(@_) },442 value => sub { $self->preferences->watermark_text_size(@_) }, 534 443 }, 535 444 $main::WMARK_COLOR => { label => gettext("Color") }, 536 445 $main::GS_WMARK_COLOR => { 537 string_selection => sub { $self-> imagelist->watermark_color(@_) },446 string_selection => sub { $self->preferences->watermark_color(@_) }, 538 447 choices => [ 539 448 map { gettext $_ } @{wxTheApp->colors} … … 543 452 $main::WMARK_POSITION => { label => gettext("Position") }, 544 453 $main::GS_WMARK_POSITION => { 545 string_selection => sub { $self-> imagelist->watermark_position(@_) },454 string_selection => sub { $self->preferences->watermark_position(@_) }, 546 455 choices => [ 547 456 map { gettext $_ } @{wxTheApp->positions} … … 551 460 $main::WMARK_MARGIN_TOP => { label => gettext("Top margin") }, 552 461 $main::GS_WMARK_MARGIN_TOP => { 553 value => sub { $self-> imagelist->watermark_y(@_) },462 value => sub { $self->preferences->watermark_y(@_) }, 554 463 }, 555 464 $main::WMARK_MARGIN_LEFT => { label => gettext("Left margin") }, 556 465 $main::GS_WMARK_MARGIN_LEFT => { 557 value => sub { $self-> imagelist->watermark_x(@_) },466 value => sub { $self->preferences->watermark_x(@_) }, 558 467 }, 559 468 $main::CHUNK_SIZE => { label => gettext("Transfert chunk size") }, 560 469 $main::GS_CHUNK_SIZE => { 561 value => sub { wxTheApp->chunk_size(@_) },470 value => sub { $self->preferences->chunk_size(@_) }, 562 471 validator => Wx::Perl::TextValidator->new( '\d' ) 563 472 }, … … 605 514 { 606 515 label => gettext("Create date"), 607 value => sub { $self->image list->current_image->create_date },516 value => sub { $self->images->current_image->create_date }, 608 517 readonly => 1, 609 518 }, 610 519 { 611 520 label => gettext("Model"), 612 value => sub { $self->image list->current_image->exif_tag('Model') },521 value => sub { $self->images->current_image->exif_tag('Model') }, 613 522 readonly => 1, 614 523 }, 615 524 { 616 525 label => gettext("Width"), 617 value => sub { $self->image list->current_image->exif_tag('ImageWidth') },526 value => sub { $self->images->current_image->exif_tag('ImageWidth') }, 618 527 readonly => 1, 619 528 }, 620 529 { 621 530 label => gettext("Height"), 622 value => sub { $self->image list->current_image->exif_tag('ImageHeight') },531 value => sub { $self->images->current_image->exif_tag('ImageHeight') }, 623 532 readonly => 1, 624 533 }, 625 534 { 626 535 label => gettext("Orientation"), 627 value => sub { $self->image list->current_image->exif_tag('Orientation') },536 value => sub { $self->images->current_image->exif_tag('Orientation') }, 628 537 readonly => 1, 629 538 }, 630 539 { 631 540 label => "ISO", 632 value => sub { $self->image list->current_image->exif_tag('ISO') },541 value => sub { $self->images->current_image->exif_tag('ISO') }, 633 542 readonly => 1, 634 543 }, 635 544 { 636 545 label => gettext("Shutter speed"), 637 value => sub { $self->image list->current_image->exif_tag('ExposureTime') },546 value => sub { $self->images->current_image->exif_tag('ExposureTime') }, 638 547 readonly => 1, 639 548 }, 640 549 { 641 550 label => gettext("Aperture"), 642 value => sub { $self->image list->current_image->exif_tag('ApertureValue') },551 value => sub { $self->images->current_image->exif_tag('ApertureValue') }, 643 552 readonly => 1, 644 553 }, 645 554 { 646 555 label => gettext("Focal length"), 647 value => sub { $self->image list->current_image->exif_tag('FocalLength') },556 value => sub { $self->images->current_image->exif_tag('FocalLength') }, 648 557 readonly => 1, 649 558 }, 650 559 { 651 560 label => gettext("Lens"), 652 value => sub { $self->image list->current_image->exif_tag('Lens') },561 value => sub { $self->images->current_image->exif_tag('Lens') }, 653 562 readonly => 1, 654 563 }, … … 657 566 658 567 $self->image_tags( 659 sub { scalar @{$self->imagelist->image_selection} > 1 ? $self->imagelist->SetImageSelectionTags(@_) : $self->imagelist->current_image->site_tags(@_)||[] } 568 sub { 569 scalar @{$self->images->selection} > 1 ? 570 $self->images->set_image_selection_tags(@_) : 571 $self->images->current_image->site_tags(@_)||[] 572 } 660 573 ); 661 574 … … 684 597 685 598 686 687 599 $self->imageviewer( 688 600 Uploader::GUI::wxImageListCtrl->new( 689 601 { 690 parentwnd => $self, 691 imagelist => $self->imagelist, 692 image_size => $self->imagelist->wx_thumb_size, 693 columns => $self->piwigo_property_list, 602 parentwnd => $self, 603 images => $self->images, 604 image_size => $self->preferences->wx_thumb_size, 605 display_mode_cbk => sub { $self->preferences->display_mode(@_) }, 606 columns => $self->piwigo_property_list, 694 607 } 695 608 ) … … 726 639 $self->show_hide_pwg_categories_empty_msg; 727 640 728 if( $self->imagelist->wx_thumb_imglist->GetImageCount){ 729 $self->ShowImageViewer; 730 731 $self->imageviewer->Refresh( 732 $self->imagelist->wx_thumb_imglist 733 ); 734 735 $self->OnUpdateImageviewerNotEmpty; 641 if( $self->images->image_count){ 642 $self->on_update_imageviewer_not_empty; 736 643 } 737 644 else{ 738 $self-> OnUpdateImageviewerEmpty;645 $self->on_update_imageviewer_empty; 739 646 } 740 647 … … 769 676 ) == wxYES 770 677 ){ 771 $self->pwg-> AddTags($name);772 $self->pwg-> RefreshTags;773 } 774 } 775 776 777 sub OnUpdateImageviewerEmpty {678 $self->pwg->add_tags($name); 679 $self->pwg->refresh_tags; 680 } 681 } 682 683 684 sub on_update_imageviewer_empty { 778 685 my ( $self ) = @_; 779 686 … … 782 689 } 783 690 784 sub OnUpdateImageviewerNotEmpty {691 sub on_update_imageviewer_not_empty { 785 692 my ( $self ) = @_; 786 693 … … 792 699 sub init_dialogs { 793 700 my ( $self ) = @_; 701 702 $self->upload_progressdlg( 703 Uploader::GUI::ImageProgressDlg->new( 704 { 705 title => gettext("Image upload progress information"), 706 progress_column => 2, 707 cancel_cbk => sub { wxTheApp->cancel_queues }, 708 } 709 ) 710 ); 711 712 $self->upload_progressdlg->Hide; 794 713 795 714 … … 805 724 $self->exif_dlg->Hide; 806 725 807 $self-> global_settings_dlg(808 Uploader::GUI:: wxGlobalSettings->new(726 $self->preferences_dlg( 727 Uploader::GUI::Preferences->new( 809 728 { 810 729 parentwnd => $self, 811 caption => gettext(" Global settings"),812 properties => $self-> global_settings,730 caption => gettext("Preferences"), 731 properties => $self->preferences_properties, 813 732 } 814 733 ) 815 734 ); 816 $self-> global_settings_dlg->Hide;735 $self->preferences_dlg->Hide; 817 736 818 737 $self->image_preview_dlg( … … 836 755 $main::DESTINATION_CATEGORIES_CANCEL => { label=>gettext("Cancel")}, 837 756 $main::DESTINATION_CATEGORIES => { 838 id_selection => sub { $self->imagelist->categories(@_) },757 id_selection => sub { wxTheApp->transfer_manager->destination_category(@_) }, 839 758 frame_callback => sub { 840 759 my ( $dlg, $ctrl, $evt ) = @_; 841 $dlg->FindWindow($main::DESTINATION_CATEGORIES_OK)->Enable( scalar @{$self->imagelist->categories});760 $dlg->FindWindow($main::DESTINATION_CATEGORIES_OK)->Enable(!wxTheApp->transfer_manager->destination_category_is_empty); 842 761 }, 843 762 }, 844 763 }, 845 frame_callback => sub { $self-> OnRefreshCategories },764 frame_callback => sub { $self->on_replace_categories }, 846 765 } 847 766 ) … … 882 801 883 802 884 sub OnPhotoProperties {803 sub on_photo_properties { 885 804 my ( $self ) = @_; 886 805 … … 889 808 890 809 891 sub OnPreview {810 sub on_preview { 892 811 my ( $self ) = @_; 893 812 … … 896 815 897 816 898 sub OnGlobalSettings {817 sub on_preferences { 899 818 my ( $self ) = @_; 900 819 901 $self->global_settings_dlg->Show(1); 902 } 903 904 905 sub OnGeneralSettingsClose { 906 my ( $self, $event ) = @_; 907 908 $self->global_settings_dlg->Hide; 909 } 910 911 912 sub OnImageExifPropClose { 913 my ( $self, $event ) = @_; 914 915 $self->image_exif_prop->Hide; 916 } 917 918 820 $self->preferences_dlg->Show(1); 821 } 919 822 920 823 … … 1045 948 my ( $self ) = @_ ; 1046 949 1047 Wx::Event::EVT_MENU( $self, 101, \& OnAddImages );1048 Wx::Event::EVT_MENU( $self, 102, \& OnRemoveImages );1049 Wx::Event::EVT_MENU( $self, 103, \& OnUploadImages );1050 Wx::Event::EVT_MENU( $self, 104, \& OnGlobalSettings );1051 Wx::Event::EVT_CHOICE( $self, 106, \& OnPhotoSelMode );1052 Wx::Event::EVT_TREE_SEL_CHANGED( $self, $self->tree, \& OnTreeSelChanged );1053 Wx::Event::EVT_TREE_ITEM_RIGHT_CLICK( $self, $self->tree, \& OnTreeItemRightClick );1054 Wx::Event::EVT_TREE_END_LABEL_EDIT( $self, $self->tree, \& OnTreeEndLabelEdit );1055 1056 Wx::Event::EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \& OnImageViewerEndLabelEdit );1057 Wx::Event::EVT_LIST_ITEM_ACTIVATED( $self, $self->imageviewer, \& OnImageViewerItemActivated );1058 Wx::Event::EVT_LIST_ITEM_SELECTED($self, $self->imageviewer, \& OnImageViewerItemSelected) ;1059 Wx::Event::EVT_LIST_ITEM_DESELECTED($self, $self->imageviewer, \& OnImageViewerItemDeSelected) ;1060 Wx::Event::EVT_LIST_ITEM_RIGHT_CLICK($self, $self->imageviewer, \& OnImageViewerItemRightClick) ;1061 1062 Wx::Event::EVT_LIST_KEY_DOWN($self, $self->imageviewer, \& OnImageViewerKeyDown) ;950 Wx::Event::EVT_MENU( $self, 101, \&on_add_images ); 951 Wx::Event::EVT_MENU( $self, 102, \&on_remove_images ); 952 Wx::Event::EVT_MENU( $self, 103, \&on_transfer_images ); 953 Wx::Event::EVT_MENU( $self, 104, \&on_preferences ); 954 Wx::Event::EVT_CHOICE( $self, 106, \&on_photo_sel_mode ); 955 Wx::Event::EVT_TREE_SEL_CHANGED( $self, $self->tree, \&on_category_sel_changed ); 956 Wx::Event::EVT_TREE_ITEM_RIGHT_CLICK( $self, $self->tree, \&on_category_right_click ); 957 Wx::Event::EVT_TREE_END_LABEL_EDIT( $self, $self->tree, \&on_category_end_label_edit ); 958 959 Wx::Event::EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \&on_image_end_label_edit ); 960 Wx::Event::EVT_LIST_ITEM_ACTIVATED( $self, $self->imageviewer, \&on_image_item_activated ); 961 Wx::Event::EVT_LIST_ITEM_SELECTED($self, $self->imageviewer, \&on_image_item_selected) ; 962 Wx::Event::EVT_LIST_ITEM_DESELECTED($self, $self->imageviewer, \&on_image_item_deselected) ; 963 Wx::Event::EVT_LIST_ITEM_RIGHT_CLICK($self, $self->imageviewer, \&on_image_item_right_click) ; 964 965 Wx::Event::EVT_LIST_KEY_DOWN($self, $self->imageviewer, \&on_image_item_key_down) ; 1063 966 1064 967 Wx::Event::EVT_CLOSE( $self, \&OnClose ); 1065 968 1066 Wx::Event::EVT_MENU( $self, 1+$ID_TREE_CTX_MENU, \& OnAddCategory );1067 Wx::Event::EVT_MENU( $self, 2+$ID_TREE_CTX_MENU, \& OnRefreshCategories );1068 Wx::Event::EVT_MENU( $self, 3+$ID_TREE_CTX_MENU, \& OnExpandCategories );1069 Wx::Event::EVT_MENU( $self, 4+$ID_TREE_CTX_MENU, \& OnCollapseCategories );1070 1071 Wx::Event::EVT_MENU( $self, 1+$ID_IMAGEVIEWER_CTX_MENU, \& OnPhotoProperties );1072 Wx::Event::EVT_MENU( $self, 2+$ID_IMAGEVIEWER_CTX_MENU, \& OnPreview );1073 1074 Wx::Event::EVT_BUTTON( $self, $main::PHOTO_PROPERTIES_UPLOAD, \& OnUploadImages );1075 Wx::Event::EVT_BUTTON( $self, $self->imageviewer->add_button->GetId, \& OnAddImages );969 Wx::Event::EVT_MENU( $self, 1+$ID_TREE_CTX_MENU, \&on_add_category ); 970 Wx::Event::EVT_MENU( $self, 2+$ID_TREE_CTX_MENU, \&on_replace_categories ); 971 Wx::Event::EVT_MENU( $self, 3+$ID_TREE_CTX_MENU, \&on_expand_categories ); 972 Wx::Event::EVT_MENU( $self, 4+$ID_TREE_CTX_MENU, \&on_collapse_categories ); 973 974 Wx::Event::EVT_MENU( $self, 1+$ID_IMAGEVIEWER_CTX_MENU, \&on_photo_properties ); 975 Wx::Event::EVT_MENU( $self, 2+$ID_IMAGEVIEWER_CTX_MENU, \&on_preview ); 976 977 Wx::Event::EVT_BUTTON( $self, $main::PHOTO_PROPERTIES_UPLOAD, \&on_transfer_images ); 978 Wx::Event::EVT_BUTTON( $self, $self->imageviewer->add_button->GetId, \&on_add_images ); 1076 979 Wx::Event::EVT_KEY_DOWN($self, \&OnKeyDown ); 1077 980 … … 1099 1002 $_ 1100 1003 ) 1101 } @{$self->imageviewer-> GetSelectedItems};1004 } @{$self->imageviewer->selected_items}; 1102 1005 $self->imageviewer_item_refresh(0); 1103 1006 } … … 1112 1015 ); 1113 1016 1017 Wx::Event::EVT_COMMAND( 1018 $self, 1019 -1, 1020 wxTheApp->resize_start_event, 1021 sub { 1022 my ( $handler, $event ) = @_; 1023 my $data = $event->GetData; 1024 $handler->upload_progressdlg->Show(1); 1025 $handler->upload_progressdlg->RequestUserAttention(wxUSER_ATTENTION_INFO); 1026 $handler->upload_progressdlg->add_images($data); 1027 } 1028 ); 1029 1030 # resize and transfer progress 1031 Wx::Event::EVT_COMMAND( 1032 $self, 1033 -1, 1034 wxTheApp->image_progress_event, 1035 sub { 1036 my ( $handler, $event ) = @_; 1037 my $data = $event->GetData; 1038 $handler->upload_progressdlg->update_image_item($data); 1039 } 1040 ); 1041 1114 1042 } 1115 1043 … … 1118 1046 my ( $self ) = @_; 1119 1047 1120 scalar @{$self->imageviewer-> GetSelectedItems};1048 scalar @{$self->imageviewer->selected_items}; 1121 1049 } 1122 1050 … … 1125 1053 my $prevdir; 1126 1054 1127 sub OnAddImages {1055 sub on_add_images { 1128 1056 my( $self, $event ) = @_; 1129 1057 1130 $prevdir = wxTheApp->default_openfile_dir if ( -d wxTheApp->default_openfile_dir);1058 $prevdir = $self->preferences->default_openfile_dir if ( -d $self->preferences->default_openfile_dir); 1131 1059 my $dialog = Wx::FileDialog->new 1132 1060 ( $self, gettext("Select photos for upload"), $prevdir, $prevfile, … … 1137 1065 if( $dialog->ShowModal != wxID_CANCEL ) { 1138 1066 @$file_paths = $dialog->GetPaths; 1139 $self-> SetNewFiles($file_paths) ;1140 } 1141 wxTheApp->default_openfile_dir(1067 $self->add_images($file_paths) ; 1068 } 1069 $self->preferences->default_openfile_dir( 1142 1070 $dialog->GetDirectory 1143 1071 ); … … 1150 1078 my( $self ) = @_; 1151 1079 1152 if($self-> global_settings_dlg->IsShown){1080 if($self->preferences_dlg->IsShown){ 1153 1081 $self->toolbar->EnableTool(104, 0); 1154 1082 } … … 1157 1085 } 1158 1086 1159 if($self-> global_settings_dlg->IsShown){1087 if($self->preferences_dlg->IsShown){ 1160 1088 $self->toolbar->EnableTool(104, 0); 1161 1089 } … … 1167 1095 1168 1096 1169 sub OnRemoveImages {1097 sub on_remove_images { 1170 1098 my( $self, $event ) = @_; 1171 1099 1172 1173 $self->imagelist->RemoveImageSelection; 1100 $self->images->remove_selection; 1174 1101 $self->imageviewer->Refresh; 1175 1102 … … 1181 1108 $self->piwigo_photo_properties_dlg->ClearProperties; 1182 1109 $self->piwigo_photo_properties_tags->ClearAllSelection; 1183 $self->image list->SetCurrentImage(-1);1184 $self-> OnUpdateImageviewerEmpty;1110 $self->images->set_current_image(-1); 1111 $self->on_update_imageviewer_empty; 1185 1112 } 1186 1113 else{ 1187 $self-> OnUpdateImageviewerNotEmpty;1114 $self->on_update_imageviewer_not_empty; 1188 1115 } 1189 1116 1190 1117 if(!$self->multi_selection_mode){ 1191 $self-> OnUpdateSingleSelectionModeUI;1118 $self->on_update_single_selection_mode; 1192 1119 } 1193 1120 … … 1196 1123 } 1197 1124 1198 sub SetNewFiles { 1125 1126 sub add_images { 1199 1127 my ( $self, $file_paths ) = @_; 1200 1128 1201 $self->ShowImageViewer(); 1202 1203 $self->progressdlg->Destroy if defined $self->progressdlg; 1204 $self->progressdlg( 1205 Uploader::GUI::wxImageProcessingProgressDlg->new( 1206 { 1207 title => gettext("Image processing progress information"), 1208 bt_label => gettext("Cancel image processing"), 1209 bt_close_label => gettext("Close"), 1210 stop_processing => sub { $self->imagelist->stop_processing(1); Wx::Yield(); }, 1211 } 1212 ) 1213 ); 1214 $self->progressdlg->Show(1); 1215 Wx::Yield(); 1216 1217 1218 my $files = [ 1219 map { 1220 # to make sure that unicode chars in filenames are supported 1221 { 1222 ANSIPathName => $^O =~ /MSWin32/ ? Win32::GetANSIPathName($_) : $_, 1223 PathName => $_, 1224 }, 1225 }@$file_paths 1226 ]; 1227 1228 @$files = sort { $a->{PathName} cmp $b->{PathName} } @$files; 1229 1230 $self->imagelist->SetNewFiles( 1231 $files 1232 ); 1233 1234 1235 } 1236 1237 1238 sub OnTreeSelChanged { 1129 $self->show_imageviewer; 1130 1131 my $bc = Wx::BusyCursor->new; 1132 $self->images->add_images( 1133 $file_paths 1134 ); 1135 1136 } 1137 1138 1139 sub on_category_sel_changed { 1239 1140 my( $self, $event ) = @_; 1240 1141 1241 $self->imagelist->categories( 1242 $event->GetEventObject->GetSelectionsIds 1243 ); 1244 } 1245 1246 sub OnTreeItemRightClick { 1142 wxTheApp->transfer_manager->destination_category( 1143 $event->GetEventObject->selection_ids 1144 ); 1145 } 1146 1147 1148 sub on_category_right_click { 1247 1149 my( $self, $event ) = @_; 1248 1150 … … 1252 1154 } 1253 1155 1254 sub OnTreeEndLabelEdit {1156 sub on_category_end_label_edit { 1255 1157 my( $self, $event ) = @_; 1256 1158 … … 1260 1162 1261 1163 if(defined($label) and !( "" eq $label )){ 1262 $self-> _SetLabel($event)1164 $self->set_category_label($event) 1263 1165 } 1264 1166 else{ … … 1267 1169 } 1268 1170 1269 sub _SetLabel {1171 sub set_category_label { 1270 1172 my( $self, $event ) = @_; 1271 1173 … … 1275 1177 $category_id = $category->{id} if 'HASH' eq ref($category) ; 1276 1178 my $comment; 1277 my ( $success, $status_msg, $content ) = $self->pwg-> SetInfoCategories(1179 my ( $success, $status_msg, $content ) = $self->pwg->set_info_category( 1278 1180 $event->GetLabel, 1279 1181 $comment, … … 1307 1209 } 1308 1210 1309 sub OnImageViewerItemRightClick {1211 sub on_image_item_right_click { 1310 1212 my( $self, $event ) = @_; 1311 1213 … … 1316 1218 } 1317 1219 1318 sub OnExpandCategories {1220 sub on_expand_categories { 1319 1221 my ( $self, $event ) = @_; 1320 1222 … … 1324 1226 } 1325 1227 1326 sub OnCollapseCategories {1228 sub on_collapse_categories { 1327 1229 my ( $self, $event ) = @_; 1328 1230 … … 1332 1234 } 1333 1235 1334 sub OnAddCategory {1236 sub on_add_category { 1335 1237 my ( $self, $event ) = @_; 1336 1238 1337 $self->tree-> AddCategory;1338 1339 } 1340 1341 1342 sub OnRefreshCategories {1239 $self->tree->add_category; 1240 1241 } 1242 1243 1244 sub on_replace_categories { 1343 1245 my ( $self, $event ) = @_; 1344 1246 … … 1353 1255 $self->tree->CollapseAll; 1354 1256 $self->tree->DeleteAllItems; 1355 $self->pwg-> RefreshCategories();1257 $self->pwg->refresh_categories; 1356 1258 $self->tree->categories( 1357 1259 $self->pwg->categories … … 1362 1264 1363 1265 1364 sub OnImageViewerEndLabelEdit {1266 sub on_image_end_label_edit { 1365 1267 my( $self, $event ) = @_; 1366 1268 1367 my $image = $self->image list->GetImage($event->GetIndex);1269 my $image = $self->images->get_image($event->GetIndex); 1368 1270 $image->site_name( 1369 1271 $event->GetLabel … … 1373 1275 } 1374 1276 1375 sub OnImageViewerItemActivated {1277 sub on_image_item_activated { 1376 1278 my( $self, $event ) = @_; 1377 1279 … … 1380 1282 ); 1381 1283 1382 $self-> OnPhotoProperties;1383 } 1384 1385 1386 sub OnImageViewerItemSelected {1284 $self->on_photo_properties; 1285 } 1286 1287 1288 sub on_image_item_selected { 1387 1289 my( $self, $event ) = @_; 1388 1290 … … 1398 1300 } 1399 1301 1400 sub OnImageViewerItemDeSelected {1302 sub on_image_item_deselected { 1401 1303 my( $self, $event ) = @_; 1402 1304 … … 1407 1309 1408 1310 } 1311 1409 1312 1410 1313 sub _on_imageviewer_item_selected { 1411 1314 my ( $self, $index ) = @_; 1412 1315 $self->current_imageviewer_index($index); 1413 $self->image list->SetCurrentImage($index);1316 $self->images->set_current_image($index); 1414 1317 1415 1318 $self->_on_imageviewer_item_selection_changed; 1416 1319 } 1320 1417 1321 1418 1322 sub _on_imageviewer_item_selection_changed { 1419 1323 my ( $self ) = @_; 1420 1324 1421 $self->image list->image_selection(1422 $self->imageviewer-> GetSelectedItems1325 $self->images->selection( 1326 $self->imageviewer->selected_items 1423 1327 ); 1424 1328 1425 1329 # for batch mode : reset the batch buffer if single selection 1426 1330 if($self->multi_selection_mode){ 1427 $self-> OnUpdateMultiSelectionModeUI;1428 $self->image list->SetImageSelectionTags([]);1429 $self->image list->image_selection_privacy_level(-1);1430 $self->image list->image_selection_name("");1431 $self->image list->image_selection_author("");1432 $self->image list->image_selection_comment("");1433 $self->image list->image_selection_create_date(-1);1331 $self->on_update_multi_selection_mode; 1332 $self->images->set_image_selection_tags([]); 1333 $self->images->selection_privacy_level(-1); 1334 $self->images->selection_name(""); 1335 $self->images->selection_author(""); 1336 $self->images->selection_comment(""); 1337 $self->images->selection_create_date(-1); 1434 1338 } 1435 1339 else{ 1436 $self-> OnUpdateSingleSelectionModeUI;1340 $self->on_update_single_selection_mode; 1437 1341 } 1438 1342 # process image_preview in idle time … … 1447 1351 } 1448 1352 1353 1449 1354 sub multi_selection_mode { 1450 1355 my ( $self ) = @_; 1451 1356 1452 scalar @{$self->imagelist->image_selection} > 1; 1453 } 1454 1455 sub OnUpdateMultiSelectionModeUI{ 1357 $self->images->selection_count > 1; 1358 } 1359 1360 1361 sub on_update_multi_selection_mode{ 1456 1362 my( $self ) = @_; 1457 1363 1458 1364 1459 1365 $self->piwigo_photo_properties_dlg->SetMultiSelectionMode( 1460 $self->imageviewer->GetSelectectItemsCount 1461 ); 1462 } 1463 1464 sub OnUpdateSingleSelectionModeUI{ 1366 $self->imageviewer->selected_items_count 1367 ); 1368 } 1369 1370 1371 sub on_update_single_selection_mode{ 1465 1372 my( $self ) = @_; 1466 1373 … … 1472 1379 my ( $self ) = @_; 1473 1380 1474 my $current_image = $self->image list->current_image;1381 my $current_image = $self->images->current_image; 1475 1382 my $image = Wx::Image->new; 1476 1383 $image->LoadFile( … … 1479 1386 ); 1480 1387 1481 if($self-> imagelist->auto_rotate){1388 if($self->preferences->auto_rotate){ 1482 1389 # exif from original image 1483 1390 my $orientation = $current_image->exif_metadata->{Orientation}; … … 1493 1400 $self->image_preview_dlg->image_size( 1494 1401 [$image->GetWidth, $image->GetHeight, ] 1495 ); 1402 ); 1496 1403 1497 1404 $self->image_preview_dlg->image( 1498 1405 $image 1499 ); 1500 } 1501 1502 sub OnImageViewerKeyDown { 1406 ); 1407 } 1408 1409 1410 sub on_image_item_key_down { 1503 1411 my( $self, $event ) = @_; 1504 1412 1505 1413 if(WXK_DELETE == $event->GetKeyCode){ 1506 $self-> OnRemoveImages();1414 $self->on_remove_images; 1507 1415 1508 1416 my $index = $self->current_imageviewer_index < $self->imageviewer->GetItemCount ? 1509 1417 $self->current_imageviewer_index : $self->imageviewer->GetItemCount -1 ; 1510 $self->imageviewer-> SelectItem(1418 $self->imageviewer->select_item( 1511 1419 $index 1512 1420 ); … … 1519 1427 1520 1428 1521 sub OnUploadImages {1429 sub on_transfer_images { 1522 1430 my( $self, $event ) = @_; 1523 1524 my $select_all = 1; 1431 1432 # all is default if single selection 1433 my $all = 1 unless $self->multi_selection_mode; 1525 1434 eval { 1526 $self-> ProcessImageSelection( $select_all );1435 $self->process_images( $all ); 1527 1436 }; 1528 1437 } 1529 1438 1530 # remove image from imagelist when uploaded 1439 1440 # remove image when uploaded 1531 1441 sub UploadImagesViewerRefresh { 1532 1442 my ( $self ) = @_; … … 1537 1447 if(!$self->imageviewer->GetItemCount){ 1538 1448 $self->image_preview_dlg->image(0); 1539 $self-> OnUpdateImageviewerEmpty;1449 $self->on_update_imageviewer_empty; 1540 1450 } 1541 1451 # reset previous selection 1542 $self->image list->image_selection(1452 $self->images->selection( 1543 1453 [] 1544 1454 ); 1545 1455 1546 1456 if(!$self->multi_selection_mode){ 1547 $self-> OnUpdateSingleSelectionModeUI;1457 $self->on_update_single_selection_mode; 1548 1458 } 1549 1459 1550 1460 $self->image_preview_dlg->Refresh; 1551 Wx::Yield(); 1552 } 1553 1554 sub UploadProgressMessageRefresh { 1555 my ( $self, $msg ) = @_; 1556 1557 Wx::Yield(); 1558 1559 $self->upload_progressdlg->processing( 1560 $msg 1561 ); 1562 $self->upload_progressdlg->LogProgress(); 1563 1564 Wx::Yield(); 1565 } 1566 1567 sub UploadProgressMessageDetailsRefresh { 1568 my ( $self, $msg ) = @_; 1569 1570 Wx::Yield(); 1571 1572 $self->upload_progressdlg->processing_details( 1573 $msg 1574 ); 1575 $self->upload_progressdlg->LogProgress(); 1576 1577 Wx::Yield(); 1578 } 1579 1580 1581 sub UploadProgressThumbnailRefresh { 1582 my ( $self ) = @_; 1583 1584 my $imagelist = $self->imagelist ; 1585 1586 1587 $self->upload_progressdlg->image->SetBitmap(wxNullBitmap); 1588 $self->upload_progressdlg->image->SetBitmap( 1589 Wx::Bitmap->new( 1590 $self->imagelist->current_image->wx_thumb_file, 1591 $self->GetWxBitmapType($self->imagelist->type), 1592 ) 1593 ); 1594 1595 Wx::Yield(); 1596 } 1597 1598 sub UploadProgressBarRefresh { 1599 my ( $self, $value ) = @_; 1600 1601 eval { 1602 $self->upload_progressdlg->progress( 1603 $value 1604 ); 1605 $self->upload_progressdlg->LogProgress(); 1606 }; 1607 #croak gettext("Upload cancelled") if $@; 1608 1609 Wx::Yield(); 1610 } 1611 1612 sub SetNewFilesDisplayEndInfo { 1613 my ( $self, $msg, $errors ) = @_; 1614 1615 if($errors){ 1616 $self->progressdlg->DisplayEndInfo($msg); 1617 } 1618 else{ 1619 $self->progressdlg->Show(0); 1620 } 1621 } 1622 1623 sub UploadDisplayEndInfo { 1624 my ( $self, $msg ) = @_; 1625 1626 my $imagelist = $self->imagelist ; 1627 1628 $self->upload_progressdlg->DisplayEndInfo($msg); 1629 } 1630 1631 sub ShowImageViewer { 1461 } 1462 1463 1464 sub show_imageviewer { 1632 1465 my ( $self ) = @_; 1633 1466 … … 1638 1471 1639 1472 1640 sub SetNewFilesViewerRefresh { 1641 1642 my ( $self ) = @_; 1643 1644 my $wximagelist = $self->imagelist->wx_thumb_imglist; 1645 #print Dumper "SetNewFilesViewerRefresh", $self->imagelist->current_image; 1646 my $indx = $wximagelist->Add( 1647 Wx::Bitmap->new( 1648 $self->imagelist->current_image->wx_thumb_file, 1649 $self->GetWxBitmapType($self->imagelist->type), 1650 ) 1651 ) if defined $self->imagelist->current_image->wx_thumb_file; 1652 #print $self->imagelist->current_image->wx_thumb_file, " added with index ", $indx, "\n"; 1653 1654 $self->imageviewer->Refresh( 1655 $wximagelist 1656 ); 1657 1658 $self->OnUpdateImageviewerNotEmpty if $self->imageviewer->GetItemCount; 1659 1660 Wx::Yield(); 1473 sub add_images_viewer_refresh { 1474 1475 my ( $self, $wx_thumb_file ) = @_; 1476 1477 $self->imageviewer->add_image($wx_thumb_file); 1478 $self->on_update_imageviewer_not_empty if $self->imageviewer->GetItemCount; 1661 1479 } 1662 1480 … … 1669 1487 1670 1488 1489 sub delete_images_viewer_refresh { 1490 my ( $self, $indx ) = @_; 1491 1492 $self->imageviewer->delete_image($indx); 1493 Wx::Yield(); 1494 } 1495 1496 1671 1497 # prepare and upload image_selection 1672 sub ProcessImageSelection{1673 my ( $self, $ select_all) = @_;1674 1675 return if wxTheApp-> CheckUpload;1676 return if !scalar @{$self->imagelist->sums};1677 1678 if( $self->destination_categories_are_empty ){1498 sub process_images { 1499 my ( $self, $all_images ) = @_; 1500 1501 return if wxTheApp->check_upload; 1502 return if $self->images->is_empty; 1503 1504 if( wxTheApp->transfer_manager->destination_category_is_empty ){ 1679 1505 return unless $self->destination_category_dlg->ShowModal != wxID_CANCEL; 1680 1506 } 1681 1507 1682 $self->imagelist->image_selection( 1683 $self->imageviewer->GetAllItems 1684 ) if $select_all; 1685 1686 return if( !defined $self->imagelist->image_selection ); 1687 return if( !scalar @{$self->imagelist->image_selection} ); 1688 1689 $self->upload_progressdlg->Destroy if defined $self->upload_progressdlg; 1690 $self->upload_progressdlg( 1691 Uploader::GUI::wxImageProcessingProgressDlg->new( 1692 { 1693 title => gettext("Image upload progress information"), 1694 bt_label => gettext("Cancel upload"), 1695 bt_close_label => gettext("Close"), 1696 stop_processing => sub { $self->imagelist->stop_processing(1); Wx::Yield(); }, 1697 } 1698 ) 1699 ); 1700 1701 # modeless dialog 1702 $self->upload_progressdlg->Show(1); 1703 Wx::Yield(); 1704 eval { 1705 $self->imagelist->UploadSelection; 1706 }; 1707 if($@){ 1708 Wx::MessageBox( 1709 sprintf( 1710 gettext("Upload cancelled"), 1711 ), 1712 gettext("Piwigo upload information"), 1713 wxOK | wxICON_INFORMATION, 1714 ); 1715 } 1716 } 1717 1718 1719 sub destination_categories_are_empty { 1720 my ( $self ) = @_; 1721 1722 !scalar @{$self->imagelist->categories}; 1723 } 1724 1725 1726 sub SetNewFilesProgress { 1727 my ( $self ) = @_; 1728 1729 my $imagelist = $self->imagelist; 1730 1731 $self->progressdlg->processing( 1732 sprintf( 1733 $imagelist->progress_msg, 1734 $imagelist->current_image->file, 1735 ) 1736 ); 1737 1738 eval { 1739 $self->progressdlg->image->SetSize([ $imagelist->wx_thumb_size, $imagelist->wx_thumb_size]); 1740 $self->progressdlg->image->SetBitmap(wxNullBitmap); 1741 $self->progressdlg->image->SetBitmap( 1742 Wx::Bitmap->new( 1743 $imagelist->current_image->wx_thumb_file, 1744 $self->GetWxBitmapType( $imagelist->type ) 1745 ) 1746 ); 1747 $self->progressdlg->progress( 1748 $imagelist->count * ( 100/scalar @{$imagelist->new_files} ) 1749 ); 1750 $self->progressdlg->LogProgress(); 1751 }; 1752 Wx::Yield(); 1753 } 1508 wxTheApp->start_resize($all_images); 1509 1510 } 1511 1754 1512 1755 1513 sub OnClose { … … 1760 1518 Wx::Log::SetActiveTarget( $self->oldlogwnd ); 1761 1519 1762 # allways store1763 1764 wxTheApp->StoreConnectionProperties;1765 1766 $self->imagelist->Store;1767 wxTheApp->login_dlg->Destroy;1768 1769 1770 wxTheApp->imageviewerIndex(1771 $self->current_imageviewer_index1772 );1773 1774 my $frameLayout = {};1775 1776 ( $frameLayout->{pX}, $frameLayout->{pY}, $frameLayout->{W}, $frameLayout->{H} ) = ( $self->GetPositionXY, $self->GetSizeWH ) ;1777 1778 wxTheApp->frameLayout(1779 $frameLayout1780 );1781 1782 wxTheApp->StoreLayoutProperties;1783 1784 1520 #destroy hidden dialogs 1785 $self-> global_settings_dlg->Destroy;1521 $self->preferences_dlg->Destroy; 1786 1522 $self->image_preview_dlg->Destroy; 1787 1523 $self->exif_dlg->Destroy; 1788 1524 $self->destination_category_dlg->Destroy; 1789 1525 1790 $self->progressdlg->Destroy if defined $self->progressdlg; 1791 $self->upload_progressdlg->Destroy if defined $self->upload_progressdlg; 1792 1526 $self->upload_progressdlg->Destroy; 1527 1528 wxTheApp->stop_all; 1529 1793 1530 $self->Destroy; 1794 1531 } … … 1869 1606 ); 1870 1607 1871 $ch->SetStringSelection(gettext($self-> imagelist->display_mode));1608 $ch->SetStringSelection(gettext($self->preferences->display_mode)); 1872 1609 $tb->Realize; 1873 1610 … … 1880 1617 } 1881 1618 1882 sub OnPhotoSelMode {1619 sub on_photo_sel_mode { 1883 1620 my ( $self, $event )= @_; 1884 1621 1885 $self-> imagelist->display_mode(1622 $self->preferences->display_mode( 1886 1623 $event->GetClientData 1887 1624 ); … … 1889 1626 $self->imageviewer->change_display_mode(1); 1890 1627 } 1628 1629 1630 sub create_textctrl { 1631 my( $self, $text, $size ) = @_; 1632 1633 return $self->_create_textctrl( $self, $text, $size ); 1634 } 1635 1891 1636 1892 1637 sub _create_textctrl { 1893 1638 my( $self, $parent, $text, $size ) = @_; 1894 1639 1895 return Wx::TextCtrl->new( $parent, -1, $text, [0, 0], $size, 1896 wxNO_BORDER | wxTE_MULTILINE | wxTE_READONLY ); 1897 } 1898 1899 sub create_textctrl { 1900 my( $self, $text, $size ) = @_; 1901 1902 return $self->_create_textctrl( $self, $text, $size ); 1640 return Wx::TextCtrl->new( 1641 $parent, 1642 -1, 1643 $text, 1644 [0, 0], 1645 $size, 1646 wxNO_BORDER|wxTE_MULTILINE|wxTE_READONLY 1647 ); 1648 } 1649 1650 1651 sub on_resize_progress_image { 1652 my ( $self, $image ) = @_; 1653 1654 $self->upload_progressdlg->update_image_item($image); 1903 1655 } 1904 1656 … … 1939 1691 my( $self, $x, $y, $files ) = @_; 1940 1692 1941 wxTheApp->frame-> SetNewFiles($files) ;1693 wxTheApp->frame->add_images($files) ; 1942 1694 } 1943 1695 … … 1996 1748 @items = grep { $self->tree->GetPlData( $_ ) != -1 } @items; 1997 1749 1998 wxTheApp-> frame->imagelist->categories(1750 wxTheApp->transfer_manager->destination_category( 1999 1751 [ 2000 1752 map { … … 2005 1757 ); 2006 1758 2007 wxTheApp-> frame->imagelist->image_selection($VAR1);2008 wxTheApp->frame-> ProcessImageSelection;1759 wxTheApp->images->selection($VAR1); 1760 wxTheApp->frame->process_images ; 2009 1761 } 2010 1762 }; -
extensions/pLoader/trunk/src/Uploader/GUI/Layout/Login.pm
r4974 r6426 7 7 use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL ); 8 8 use Wx qw( wxTE_PASSWORD ); 9 use Wx::Locale ;9 use Wx::Locale qw/:default/; 10 10 11 11 # Bitmap functions -
extensions/pLoader/trunk/src/Uploader/GUI/wxCategoryTreeCtrl.pm
r5390 r6426 188 188 $self->SetMinSize( [20+$wp, -1 ]); 189 189 190 Wx::Event::EVT_BUTTON( $self, $main::CATEGORIES_ADD, \& AddCategory );190 Wx::Event::EVT_BUTTON( $self, $main::CATEGORIES_ADD, \&add_category ); 191 191 } 192 192 … … 221 221 222 222 223 sub GetSelectionsIds {223 sub selection_ids { 224 224 my ( $self )=@_; 225 225 … … 238 238 239 239 240 sub AddCategory {240 sub add_category { 241 241 my ( $self, $event ) = @_; 242 242 243 $self-> SelectDefaultParent;244 245 my $parent_category_id = $self-> GetSelectionsIds->[0];243 $self->select_default_parent; 244 245 my $parent_category_id = $self->selection_ids->[0]; 246 246 my $parent_item = $self->GetSelection; 247 247 … … 255 255 if( $dialog->ShowModal != wxID_CANCEL ) { 256 256 my $name = $dialog->GetValue; 257 my ( $success, $status_msg, $content ) = wxTheApp->pwg-> AddCategories( $name, $parent_category_id);257 my ( $success, $status_msg, $content ) = wxTheApp->pwg->add_categories( $name, $parent_category_id); 258 258 259 259 if($success){ … … 270 270 271 271 272 sub SelectDefaultParent {273 my ( $self ) = @_; 274 275 if(!scalar @{$self-> GetSelectionsIds}){272 sub select_default_parent { 273 my ( $self ) = @_; 274 275 if(!scalar @{$self->selection_ids}){ 276 276 $self->SelectItem($self->GetRootItem); 277 277 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r5392 r6426 66 66 prevItemCount 67 67 imagenames 68 image list68 images 69 69 wx_imagelist 70 70 image_size … … 74 74 initialize 75 75 columns 76 display_mode_cbk 76 77 change_display_mode 77 78 wx_img 78 79 item_refresh 80 image_type 79 81 / 80 82 ); … … 93 95 ); 94 96 97 # for list mode 95 98 $self->wx_img( 96 99 Wx::ImageList->new( 16, 16, 1 ) … … 100 103 ); 101 104 102 $self->imagelist( 103 $params->{imagelist} 104 ); 105 $self->images( 106 $params->{images} 107 ); 108 109 $self->image_size( 110 $params->{image_size} 111 ); 112 113 $self->display_mode_cbk( 114 $params->{display_mode_cbk} 115 ); 116 105 117 # bitmap container for photo selection 106 118 $self->wx_imagelist( 107 $params->{wx_imagelist}||$self->imagelist->wx_thumb_imglist 108 ); 109 110 $self->image_size( 111 $params->{image_size} 112 ); 119 Wx::ImageList->new( 120 $self->image_size, 121 $self->image_size, 122 1, 123 0 124 ) 125 ); 126 127 $self->load_images; 113 128 114 129 $self->columns( … … 139 154 } 140 155 if($self->change_display_mode){ 141 my $d m = $self->imagelist->display_mode;142 $self->initialize->{$dm}->($self) if exists $self->initialize->{$dm};156 my $disp_mode = $self->display_mode_cbk->(); 157 $self->initialize->{$disp_mode}->($self) if exists $self->initialize->{$disp_mode}; 143 158 $self->Refresh; 144 159 $self->change_display_mode(0); … … 206 221 'Thumbnail' => sub {}, 207 222 'Thumbnail and caption' => sub { my ( $self, $index ) = @_; 208 my $image = $self->image list->GetImage($index);223 my $image = $self->images->get_image($index); 209 224 $self->SetItem( 210 225 $index, … … 215 230 'Property list' => sub { my ( $self, $index ) = @_; 216 231 my $col = 0; 217 my $image = $self->image list->GetImage($index);232 my $image = $self->images->get_image($index); 218 233 map{ 219 234 $self->SetItem( … … 236 251 $self->InsertImageStringItem( 237 252 $index, 238 $self->image list->GetImage($index)->site_name,253 $self->images->get_image($index)->site_name, 239 254 $index, 240 ) ;255 ) if defined $self->images->get_image($index); 241 256 }, 242 257 'Property list' => sub { my ( $self, $index ) = @_; … … 253 268 ); 254 269 255 256 $self->initialize->{$ self->imagelist->display_mode}->($self) if exists $self->initialize->{$self->imagelist->display_mode};270 my $disp_mode = $self->display_mode_cbk->(); 271 $self->initialize->{$disp_mode}->($self) if exists $self->initialize->{$disp_mode}; 257 272 258 273 $self->init_empty_msg; 259 274 260 275 $self; 276 } 277 278 279 sub load_images { 280 my ( $self ) = @_; 281 282 my $image_ids = $self->images->ordered_image_ids; 283 #print "load_images\n", Dumper $self->images->ordered_image_ids; 284 my $image_index = 0; 285 map { 286 my $image = $self->images->Image($_); 287 288 #print Dumper $image; 289 if(defined $image){ 290 $self->load_image($image); 291 } 292 else{ 293 # something went wrong 294 warn printf("Error loading image %s, %s\n", $image_index, $_); 295 } 296 297 $image_index++; 298 } 299 @$image_ids ; 300 301 } 302 303 304 sub load_image { 305 my ( $self, $image ) = @_; 306 307 my $wximagelist = $self->wx_imagelist; 308 309 unless( -e $image->wx_thumb_file ) { 310 $self->images->create_wx_thumbnail_cbk->($image) 311 if 'CODE' eq ref $self->images->create_wx_thumbnail_cbk; 312 } 313 314 $wximagelist->Add( 315 Wx::Bitmap->new( 316 $image->wx_thumb_file, 317 wxBITMAP_TYPE_JPEG, 318 ) 319 ); 261 320 } 262 321 … … 264 323 my ( $self, $index ) = @_; 265 324 266 $self->item_refresh->{$self->imagelist->display_mode}->($self, $index) if exists $self->item_refresh->{$self->imagelist->display_mode}; 325 my $disp_mode = $self->display_mode_cbk->(); 326 $self->item_refresh->{$disp_mode}->($self, $index) if exists $self->item_refresh->{$disp_mode}; 267 327 } 268 328 … … 272 332 273 333 my $data = Wx::TextDataObject->new( 274 Dumper $self-> GetSelectedItems334 Dumper $self->selected_items 275 335 ); 276 336 my $source = Wx::DropSource->new( $self ); … … 280 340 } 281 341 282 sub GetSelectectItemsCount {342 sub selected_items_count { 283 343 my ( $self ) = @_; 284 344 285 scalar @{$self->GetSelectedItems}; 286 } 287 288 sub GetSelectedItems { 345 scalar @{$self->selected_items}; 346 } 347 348 349 sub selected_items { 289 350 my ( $self ) = @_; 290 351 … … 307 368 } 308 369 309 sub GetAllItems {370 sub all_items { 310 371 my ( $self ) = @_; 311 372 … … 330 391 331 392 393 sub add_image { 394 my ( $self, $wx_thumb_file ) = @_; 395 396 397 my $indx = $self->wx_imagelist->Add( 398 Wx::Bitmap->new( 399 $wx_thumb_file, 400 wxBITMAP_TYPE_JPEG, 401 ) 402 ) if defined $wx_thumb_file; 403 404 405 $self->Refresh; 406 } 407 408 sub delete_image { 409 my ( $self, $indx ) = @_; 410 411 $self->wx_imagelist->Remove($indx); 412 } 413 414 332 415 sub Refresh { 333 416 my ( $self ) = @_; … … 344 427 for( my $i = 0 ; $i < $self->wx_imagelist->GetImageCount ; $i++){ 345 428 # call the method corresponding to the display mode 346 my $indx = $self->insert_items->{$self->imagelist->display_mode}->($self, $i); 347 if( 'Thumbnail' eq $self->imagelist->display_mode){ 429 my $disp_mode = $self->display_mode_cbk->(); 430 my $indx = $self->insert_items->{$disp_mode}->($self, $i); 431 if( 'Thumbnail' eq $disp_mode){ 348 432 my $row = floor($i/$ipr); 349 433 my $col = $i%$ipr; … … 360 444 361 445 map{ 362 $self-> SelectItem(446 $self->select_item( 363 447 $_ 364 448 ); 365 449 366 450 $self->EnsureVisible($_); 367 } @{$self->image list->image_selection||[]};451 } @{$self->images->selection||[]}; 368 452 369 453 $self->Thaw(); … … 371 455 } 372 456 373 sub SelectItem {457 sub select_item { 374 458 my ( $self, $index ) = @_; 375 459 -
extensions/pLoader/trunk/src/Uploader/Image.pm
r5472 r6426 21 21 use strict; 22 22 use base qw/Uploader::Object/; 23 use File::Spec; 24 use Image::ExifTool qw(:Public); 25 use Data::Dumper; 23 26 24 __PACKAGE__->mk_accessors( 25 qw/ 26 file 27 wx_thumb_file 28 site_high_file 29 site_name 30 site_resized_file 31 site_thumb_file 32 site_author 33 site_comment 34 site_original_filename 35 exif_metadata 36 add_rank 37 site_categories 38 site_tags 39 file_sum 40 width 41 height 42 privacy_level 43 caption 44 / 45 ); 27 # we need a ref to data preferences to use with threads 28 my @properties = qw/ 29 file 30 wx_thumb_file 31 site_high_file 32 site_name 33 site_resized_file 34 site_thumb_file 35 site_author 36 site_comment 37 site_original_filename 38 exif_metadata 39 add_rank 40 site_categories 41 site_tags 42 image_id 43 width 44 height 45 privacy_level 46 caption 47 global_rank 48 /; 49 50 my $init_caption_from_pattern_cbk; 51 52 __PACKAGE__->mk_accessors(@properties); 46 53 47 54 sub Init { 48 55 my ( $self ) = @_; 49 56 57 58 my $exif = $self->read_exif_metadata( 59 $self->file 60 ); 61 62 $self->exif_metadata( 63 $self->select_exif_data($exif) 64 ); 65 66 67 68 $self->site_original_filename( 69 $self->original_filename 70 ); 71 50 72 } 73 74 75 sub read_exif_metadata { 76 my ( $self, $file ) = @_; 77 78 # read exif metadata 79 my $info; 80 eval { 81 $info = ImageInfo( $file ); 82 }; 83 $info = {} if($@); 84 85 $info; 86 } 87 51 88 52 89 sub exif_tag { 53 90 my ( $self, $tag ) = @_; 54 91 55 92 my $exif = $self->exif_metadata ; 56 93 57 $exif->{$tag}; 94 $exif->{$tag}; 58 95 } 96 59 97 60 98 sub create_date { … … 64 102 65 103 $self->{-create_date} ||= $exif->{CreateDate}; 66 104 67 105 $self->{-create_date} = $date if defined $date; 68 106 69 107 $self->{-create_date}; 70 108 } 71 109 72 110 111 sub select_exif_data { 112 my ( $self, $exif ) = @_; 113 114 return { 115 map { 116 $_ => $exif->{$_}, 117 } 118 qw/ 119 CreateDate 120 ImageWidth 121 ImageHeight 122 Orientation 123 DateTimeOriginal 124 ISO 125 ExposureTime 126 ApertureValue 127 FocalLength 128 Lens 129 Exposure 130 Make 131 Model 132 / 133 }; 134 } 135 136 137 sub original_filename { 138 my ( $self ) = @_; 139 140 my ( $vol, $dir, $filename ) = File::Spec->splitpath( 141 $self->file 142 ); 143 144 $filename; 145 } 146 147 sub get_data { 148 my ( $self, $preferences, $destination_category, $add_rank ) = @_; 149 150 my $data = { 151 map { $_ => $self->$_ } @properties 152 }; 153 $data->{preferences} = $preferences; 154 $data->{categories} = $destination_category; 155 $data->{site_img_date_creation} = $self->create_date; 156 $data->{add_rank} = $add_rank; 157 158 return $data; 159 } 73 160 74 161 1; -
extensions/pLoader/trunk/src/Uploader/Object.pm
r4779 r6426 26 26 use base qw/ 27 27 Class::Accessor::Fast 28 /; 28 /; 29 30 __PACKAGE__->mk_accessors(qw/ 31 version 32 storable_file 33 /); 29 34 30 35 # $param is a hash with : … … 37 42 my $self = bless $params, $class ; 38 43 39 # create member accessors40 #__PACKAGE__->mk_accessors(41 # keys %$params42 #);43 44 45 if(defined $self->{plugin_file}){46 die "Plugin file is missing." unless -e $self->{plugin_file};47 $self->InitPlugins();48 }49 50 44 # member accessors initialization 51 45 eval { 52 46 map { 53 54 55 47 $self->$_( 48 $params->{$_} 49 ); 56 50 } 57 51 keys %$params; … … 64 58 $self->Init(); 65 59 66 67 60 return $self; 68 61 } 69 62 70 63 71 sub InitPlugins { 72 my ( $self ) = @_; 73 74 my $data; 75 eval { $data = read_file( $self->{plugin_file} ); } ; 64 sub read_params { 65 my( $self, $file, $key ) = @_ ; 76 66 77 my $plugins = [] ; 78 if( defined $data){ 79 my $expr = '$plugins = ' ; 80 $expr .= "$data " ; 67 my $expr_params ; 68 eval { $expr_params = read_file( $file ); } ; 69 70 my $paramValues = [] ; 71 if($expr_params){ 72 my $expr = '$paramValues = ' ; 73 $expr .= "$expr_params " ; 81 74 eval $expr ; 82 75 } 83 # load plugins 84 85 my $hplugins = $plugins->[0] if scalar @$plugins; 86 while( my ( $key, $value ) = each %$hplugins ) { 87 $self->ReadParams( $value, $key); 88 } 89 90 } 91 92 sub ReadParams { 93 my( $self, $file, $key ) = @_ ; 94 95 my $expr_params ; 96 eval { $expr_params = read_file( $file ); } ; 97 98 my $paramValues = [] ; 99 if($expr_params){ 100 my $expr = '$paramValues = ' ; 101 $expr .= "$expr_params " ; 102 eval $expr ; 103 } 104 return unless 'ARRAY' eq ref $paramValues ; 76 return unless 'ARRAY' eq ref $paramValues ; 105 77 if($@){ 106 78 die "Cannot load data $@"; 107 79 } 108 109 110 $self->SetKeyValues($params, $key);111 80 if(scalar(@$paramValues )){ 81 my $params = $paramValues->[0] ; 82 $self->set_key_values($params, $key); 83 } 112 84 } 113 85 114 sub SetKeyValues { 86 87 sub set_key_values { 115 88 my ( $self, $params, $key )= @_; 116 89 if (defined $key) { … … 132 105 my $data = { 133 106 map { 134 107 $_ => $self->{$_}, 135 108 } 136 109 @$keys … … 140 113 } 141 114 115 142 116 1; -
extensions/pLoader/trunk/src/Uploader/PWG.pm
r6088 r6426 56 56 } 57 57 else{ 58 $self-> GetMethods;59 $self-> RefreshCategories;60 $self-> RefreshTags;58 $self->get_methods; 59 $self->refresh_categories; 60 $self->refresh_tags; 61 61 } 62 62 } 63 63 64 sub RefreshCategories {64 sub refresh_categories { 65 65 my ( $self ) = @_; 66 66 67 67 $self->categories( 68 68 $self->prepare_items( 69 $self-> GetCategories69 $self->get_categories 70 70 ) 71 71 ); 72 72 } 73 73 74 sub RefreshTags {74 sub refresh_tags { 75 75 my ( $self ) = @_; 76 76 77 77 $self->tags( 78 $self-> GetTags78 $self->get_tags 79 79 ); 80 80 } -
extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm
r6088 r6426 46 46 qry_list_tags 47 47 qry_check_upload 48 items49 tags50 categories51 site_original_filename52 site_high_file53 site_resized_file54 site_thumb_file55 site_image_name56 site_tags57 rank58 site_author59 site_comment60 site_img_date_creation61 48 uagent_response 62 49 login_result 63 action_result 64 upload_high 65 chunk_size 66 sum 67 image_id 50 categories 51 tags 68 52 typecode 69 reupload_action_files 70 reupload_action_properties 71 reupload_action_properties_m 53 file_type 72 54 single_value_mode 73 55 multiple_value_mode 74 privacy_level75 56 is_method_available 57 log_progress_cbk 76 58 / 77 59 ); … … 90 72 } 91 73 ); 74 75 $self->file_type({ 76 thumb => 'site_thumb_file', 77 file => 'site_resized_file', 78 high => 'site_high_file', 79 }); 80 92 81 93 82 $self->single_value_mode( … … 125 114 ); 126 115 127 $self->chunk_size(128 $self->{chunk_size}129 );130 131 116 132 117 $self->uagent->default_headers->authorization_basic( … … 169 154 }; 170 155 171 $self-> _execute_post(156 $self->execute_post( 172 157 $form 173 158 ); 174 159 175 160 $self->login_result( 176 $self-> _json_response_content177 ); 178 179 } 180 181 sub _json_response_content {161 $self->json_response_content 162 ); 163 164 } 165 166 sub json_response_content { 182 167 my ( $self ) = @_; 183 168 … … 216 201 } 217 202 218 sub _execute_get {203 sub execute_get { 219 204 my ( $self, $query ) = @_; 220 205 … … 235 220 } 236 221 237 sub _execute_post {222 sub execute_post { 238 223 my ( $self, $form ) = @_; 239 224 … … 257 242 } 258 243 259 sub GetCategories {244 sub get_categories { 260 245 my ( $self ) = @_; 261 246 262 247 263 $self-> _execute_get(248 $self->execute_get( 264 249 $self->qry_list_categories 265 250 ); 266 $self-> _json_response_content->{result}{categories};267 } 268 269 sub GetTags {251 $self->json_response_content->{result}{categories}; 252 } 253 254 sub get_tags { 270 255 my ( $self ) = @_; 271 256 272 $self-> _execute_get(257 $self->execute_get( 273 258 $self->qry_list_tags 274 259 ); 275 $self-> _json_response_content->{result}{tags};276 } 277 278 sub AddTags {260 $self->json_response_content->{result}{tags}; 261 } 262 263 sub add_tags { 279 264 my ( $self, $name ) = @_; 280 265 … … 285 270 }; 286 271 287 return ( $self-> _execute_post($form), $self->_json_response_content );272 return ( $self->execute_post($form), $self->json_response_content ); 288 273 } 289 274 290 sub CheckUpload {275 sub check_upload { 291 276 my ( $self ) = @_; 292 277 … … 294 279 295 280 if($self->is_method_available->{'pwg.images.checkUpload'}){ 296 $self-> _execute_get(281 $self->execute_get( 297 282 $self->qry_check_upload 298 283 ); 299 # my $result = $self->_json_response_content->{result}; 300 my $hresult = $self-> _json_response_content;284 285 my $hresult = $self->json_response_content; 301 286 302 287 $err_msg = 'ok' eq $hresult->{stat} ? … … 308 293 } 309 294 310 sub GetMethods { 295 296 sub get_methods { 311 297 my ( $self ) = @_; 312 298 313 $self-> _execute_get(299 $self->execute_get( 314 300 $self->qry_list_methods 315 301 ); 316 302 317 my $methods = $self-> _json_response_content->{result}{methods};303 my $methods = $self->json_response_content->{result}{methods}; 318 304 319 305 $self->is_method_available( … … 328 314 } 329 315 330 sub UploadImage { 331 my ( $self, $progress ) = @_; 332 333 return if $progress->{stop_processing}; 334 335 $self->image_id( 336 $self->_exists($progress->{original_sum}) 337 ); 338 339 my $status = 1; 340 my $status_line ="OK"; 341 my $content = {}; 342 my $doubleCheck; 343 my $form; 344 UPLOAD: while(1){ 345 # first upload 346 if(!defined($self->image_id)){ 347 $doubleCheck = 1; 348 $self->_checksum_files($progress); 349 my @types = ('file', 'thumb'); 350 #printf("WS upload_high %s\n", $self->upload_high); 351 push @types, 'high' if $self->upload_high; 352 map{ 353 my $rval = $self->_send_chunks($_, $progress); 354 $status_line = $rval->{message}; 355 if (!$rval->{ok}){ 356 $status = 0; 357 last UPLOAD ; 358 } 359 } @types; 360 361 362 $form = { 363 method => 'pwg.images.add', 364 original_sum => $self->sum->{original}, 365 original_filename => $self->site_original_filename, 366 file_sum => $self->sum->{file}, 367 thumbnail_sum => $self->sum->{thumb}, 368 categories => $self->categories, 369 name => $self->site_image_name, 370 author => $self->site_author, 371 comment => $self->site_comment, 372 date_creation => $self->site_img_date_creation, 373 tag_ids => $self->site_tags, 374 375 }; 376 377 $form->{high_sum} = $self->sum->{high} if $self->upload_high; 378 379 $progress->{yield}->(); 380 ( $status, $status_line ) = $self->_execute_post($form); 381 } 382 # re-upload 383 else{ 384 # need to check if files have changed 385 # and update image info 386 if($self->reupload_action_files){ 387 $self->_checksum_files($progress); 388 my $files = $self->_check_files(); 389 if(defined($files)){ 390 $self->_add_files($files, $progress); 391 } 392 } 393 394 $form = { 395 method => 'pwg.images.setInfo', 396 image_id => $self->image_id, 397 }; 398 # update metadata info 399 # simple value metadata 400 if($self->reupload_action_properties){ 401 $form->{name} = $self->site_image_name; 402 $form->{author} = $self->site_author; 403 $form->{comment} = $self->site_comment; 404 $form->{date_creation} = $self->site_img_date_creation; 405 $form->{single_value_mode} = $self->single_value_mode->{$self->reupload_action_properties}; 406 $form->{level} = $self->privacy_level ? 2**($self->privacy_level - 1) : 0; 407 } 408 # multi value metadata 409 if($self->reupload_action_properties_m){ 410 $form->{tag_ids} = $self->site_tags if $self->site_tags; 411 $form->{categories} = $self->categories; 412 $form->{multiple_value_mode} = $self->multiple_value_mode->{$self->reupload_action_properties_m}; 413 }; 414 $progress->{yield}->(); 415 ( $status, $status_line ) = $self->_execute_post($form); 416 417 } 418 419 delete $form->{tag_ids} unless defined $self->site_tags; 420 delete $form->{tag_ids} if '' eq $self->site_tags; 421 422 $progress->{yield}->(); 423 # for first upload 424 # make sure the image is uploaded by querying for its existence 425 if($doubleCheck){ 426 $self->image_id( 427 $self->_exists($progress->{original_sum}) 428 ); 429 $content->{stat} = !defined $self->image_id ? 'fail' : 'ok'; 430 if(defined $self->image_id and defined $self->privacy_level){ 431 ( $status, $status_line, $content ) = $self->_set_privacy_level; 432 } 433 } 434 435 last UPLOAD; 436 }# UPLOAD 437 438 return ( $status, $status_line, $content); 439 } 440 441 sub _set_privacy_level { 442 my ( $self ) = @_; 316 317 sub exists_image { 318 my ( $self, $image ) = @_; 319 320 my $image_sum = $image->{image_id}; 321 my $form = { 322 method => 'pwg.images.exist', 323 md5sum_list => $image_sum, 324 }; 325 326 $self->execute_post($form); 327 my $hresult = $self->json_response_content; 328 329 $hresult->{result} = {} if 'HASH' ne ref $hresult->{result}; 330 331 my $pwg_image_id = 'ok' eq $hresult->{stat} ? 332 $hresult->{result}{$image_sum} : 333 undef ; 334 335 $image->{pwg_image_id} = $pwg_image_id; 336 337 return $pwg_image_id; 338 } 339 340 341 sub set_image_privacy_level { 342 my ( $self, $image ) = @_; 443 343 444 344 my $form = { 445 345 method => 'pwg.images.setPrivacyLevel', 446 image_id => $ self->image_id,447 level => $ self->privacy_level ? 2**($self->privacy_level- 1) : 0,448 }; 449 450 my ( $status, $status_line ) = $self-> _execute_post($form);451 my $hresult = $self-> _json_response_content;346 image_id => $image->{pwg_image_id}, 347 level => $image->{privacy_level} ? 2**($image->{privacy_level} - 1) : 0, 348 }; 349 350 my ( $status, $status_line ) = $self->execute_post($form); 351 my $hresult = $self->json_response_content; 452 352 453 353 ($status, $status_line, $hresult ); 454 354 } 455 355 456 sub _checksum_files { 457 my ( $self, $progress ) = @_; 458 459 $self->sum( 460 { 461 file => $self->_checksum( 462 $self->site_resized_file, 463 $progress 464 ), 465 thumb => $self->_checksum( 466 $self->site_thumb_file, 467 $progress 468 ), 469 original => $progress->{original_sum} 470 } 471 ); 472 473 $self->sum->{high} = $self->_checksum( 474 $self->site_high_file, 475 $progress 476 ) if $self->upload_high ; 477 } 478 479 sub _check_files { 480 my ( $self ) = @_; 356 357 sub update_image_modified_files { 358 my ( $self, $image ) = @_; 359 360 my $modified_ftc = $self->image_modified_file_type_codes($image); 361 map{ 362 $self->add_image_file_type($image, $_); 363 }@$modified_ftc; 364 365 } 366 367 368 # 'file', 'thumb', 'high' 369 sub image_modified_file_type_codes { 370 my ( $self, $image ) = @_; 481 371 482 372 my $form = { 483 373 method => 'pwg.images.checkFiles', 484 image_id => $ self->image_id,374 image_id => $image->{pwg_image_id}, 485 375 }; 486 376 487 377 @$form{'thumbnail_sum', 'file_sum' } = ( 488 $self->sum->{thumb}, 489 $self->sum->{file}, 490 ); 491 492 if($self->upload_high){ 493 $form->{high_sum} = $self->sum->{high}; 494 } 495 496 $self->_execute_post($form); 497 my $hresult = $self->_json_response_content; 498 499 my $rval = 'ok' eq $hresult->{stat} ? $hresult->{result} : undef; 500 501 $rval; 502 } 503 504 # $files is returned by _check_files 505 # { 506 # thumbnail => 'equals', 'differs', 'missing' 507 # file => 'equals', 'differs', 'missing' 508 # high => 'equals', 'differs', 'missing' 509 #} 510 511 sub _add_files { 512 my ( $self, $files, $progress ) = @_; 513 514 map{ 515 $self->_add_file($_, $progress); 516 } 517 map{ 518 $self->typecode->{$_}; 519 } grep { 'equals' ne $files->{$_} } keys %$files ; 520 521 } 522 523 sub _add_file { 524 my ( $self, $type_code, $progress ) = @_; 525 526 $self->_send_chunks( 527 $type_code, 528 $progress, 529 ); 530 531 my $form = { 532 method => 'pwg.images.addFile', 533 image_id => $self->image_id, 534 type => $type_code, 535 sum => $self->sum->{$type_code}, 536 }; 537 538 $self->_execute_post($form); 539 my $hresult = $self->_json_response_content; 540 541 my $rval = 'ok' eq $hresult->{stat} ? $hresult->{result} : undef; 542 543 $rval; 544 } 378 $image->{site_thumb_file_checksum}, 379 $image->{site_resized_file_checksum}, 380 ); 381 382 if($image->{upload_high}){ 383 $form->{high_sum} = $image->{site_high_file_checksum}; 384 } 385 $self->execute_post($form); 386 my $hresp = $self->json_response_content; 387 388 my $hmodified = 'ok' eq $hresp->{stat} ? $hresp->{result} : {}; 389 # $hmodified : 390 # { 391 # thumbnail => 'equals', 'differs', 'missing' 392 # file => 'equals', 'differs', 'missing' 393 # high => 'equals', 'differs', 'missing' 394 #} 395 396 my $modified = [ 397 map{ 398 $self->typecode->{$_}; 399 } grep { 'equals' ne $hmodified->{$_} } keys %$hmodified 400 ]; 401 402 # $modified contains : 'thumbnail', 'file', 'high' 403 # or empty if nothing has changed 404 $modified; 405 } 406 407 408 sub update_image_properties { 409 my ( $self, $image ) = @_; 410 411 my $reupload_ap = $image->{preferences}{reupload_action_properties}; 412 my $reupload_apm = $image->{preferences}{reupload_action_properties_m}; 413 414 my $form = { 415 method => 'pwg.images.setInfo', 416 image_id => $image->{pwg_image_id}, 417 }; 418 # update metadata info 419 # simple value metadata 420 if($reupload_ap){ 421 $form->{name} = $image->{site_name}; 422 $form->{author} = $image->{site_author}; 423 $form->{comment} = $image->{site_comment}; 424 $form->{date_creation} = $image->{site_img_date_creation}; 425 $form->{single_value_mode} = $self->single_value_mode->{$reupload_ap}; 426 $form->{level} = $image->{privacy_level} ? 2**($image->{privacy_level} - 1) : 0; 427 } 428 429 # multi value metadata 430 if($reupload_apm){ 431 $form->{tag_ids} = $image->{site_tags} if $image->{site_tags}; 432 $form->{categories} = $image->{categories}; 433 $form->{multiple_value_mode} = $self->multiple_value_mode->{$reupload_apm}; 434 } 435 436 $self->execute_post($form); 437 438 } 439 440 441 545 442 546 443 sub IsAlreadyUploaded { … … 548 445 549 446 # md5_sums is an array ref 550 $self-> _execute_post({447 $self->execute_post({ 551 448 method => 'pwg.images.exist', 552 449 md5sum_list => join(',', @$md5_sums) … … 554 451 ); 555 452 556 my $sums = $self-> _json_response_content->{result};453 my $sums = $self->json_response_content->{result}; 557 454 558 455 $sums; 559 456 } 560 457 561 sub _exists { 562 my ( $self, $md5_sum ) = @_; 563 564 my $form = { 565 method => 'pwg.images.exist', 566 md5sum_list => $md5_sum, 567 }; 568 569 $self->_execute_post($form); 570 my $hresult = $self->_json_response_content; 571 572 $hresult->{result} = {} if 'HASH' ne ref $hresult->{result}; 573 my $id = 'ok' eq $hresult->{stat} ? $hresult->{result}{$md5_sum} : undef ; 574 575 $id; 576 } 577 578 sub _checksum { 579 my ( $self, $file, $progress ) = @_; 580 my $file_sum; 581 582 my $yield = $progress->{yield}; 583 584 $yield->(); 585 $progress->{msg_details}->( 586 sprintf( 587 "%s : %s", 588 $progress->{checksum_msg}, 589 $file 590 ) 591 ); 592 593 eval { 594 $file_sum = file_md5_hex( 595 $file 458 459 sub send_image_files_chunks { 460 my ( $self, $image ) = @_; 461 462 my $errors = 0; 463 464 my @types = ('file', 'thumb'); 465 push @types, 'high' if $image->{upload_high}; 466 map{ 467 my $rval = $self->send_image_file_type_chunks( 468 $image, 469 $_, 596 470 ); 597 }; 598 $yield->(); 599 600 $file_sum; 601 } 602 603 sub _send_chunks { 604 my ( $self, $type_code, $progress ) = @_; 605 606 my $msg = { 607 thumb=>'thumbnail_msg', 608 file=>'resized_msg', 609 high=>'highdef_msg', 610 }; 611 612 my $filepath = { 613 thumb=>$self->site_thumb_file, 614 file=>$self->site_resized_file, 615 high=>$self->site_high_file, 616 }; 617 618 $progress->{current_msg} = $progress->{$msg->{$type_code}}; 619 $progress->{yield}->(); 620 621 my $params = { 622 filepath => $filepath->{$type_code}, 623 type => $type_code, 624 original_sum => $self->sum->{original}, 625 }; 626 #print Dumper $params; 627 $self->send_chunks( 628 $params, 629 $progress, 630 ); 631 $progress->{yield}->(); 632 633 $params; 634 } 635 636 sub AddCategories{ 637 my ( $self, $name, $parentid ) = @_; 638 639 my $form = { 640 method => 'pwg.categories.add', 641 name => $name, 642 parent => $parentid, 643 644 }; 645 646 return ( $self->_execute_post($form), $self->_json_response_content ); 647 } 648 649 sub SetInfoCategories{ 650 my ( $self, $name, $comment, $parentid ) = @_; 651 652 my $form = { 653 method => 'pwg.categories.setInfo', 654 name => $name, 655 comment => $comment, 656 category_id => $parentid, 657 658 }; 659 660 return ( $self->_execute_post($form), $self->_json_response_content ); 661 } 662 663 664 sub send_chunks { 665 my ( $self, $params, $progress ) = @_; 666 667 my $yield = $progress->{yield}; 668 my ( $vol, $dir, $filename ) = File::Spec->splitpath($params->{filepath}); 669 670 $yield->(); 671 $progress->{bar}->(0); 672 $yield->(); 673 $progress->{msg_details}->( 674 sprintf( 675 "%s : %s", 676 $progress->{current_msg}, 677 $filename 678 ) 679 ); 680 681 682 $yield->(); 471 if (!$rval->{ok}){ 472 $errors += 1; 473 } 474 } @types; 475 476 $errors; 477 } 478 479 480 sub send_image_file_type_chunks { 481 my ( $self, $image, $file_type_code ) = @_; 482 483 $image->{file_type_code} = $file_type_code; 484 485 $self->send_image_chunks( 486 $image 487 ); 488 } 489 490 491 sub send_image_chunks { 492 my ( $self, $image ) = @_; 493 494 my $params = {}; 495 496 my $file = $self->get_image_file($image); 497 498 my ( $vol, $dir, $filename ) = File::Spec->splitpath( 499 $file 500 ); 501 683 502 my $content = read_file( 684 $ params->{filepath},503 $file, 685 504 binmode => ':raw', 686 505 ); 687 $yield->(); 688 506 507 my $chunk_size = $image->{preferences}{chunk_size}||500000; 689 508 my $content_length = length($content); 690 my $nb_chunks = ceil($content_length / $ self->chunk_size->());509 my $nb_chunks = ceil($content_length / $chunk_size); 691 510 692 511 my $chunk_pos = 0; 693 512 my $chunk_id = 1; 513 514 $self->log_image_progress( 515 $image, 516 sprintf("sending %s", $image->{file_type_code}), 517 0, 518 ); 694 519 695 520 … … 699 524 $content, 700 525 $chunk_pos, 701 $ self->chunk_size->()526 $chunk_size 702 527 ); 703 $chunk_pos += $self->chunk_size->(); 704 #print "pwg.images.addChunk\n"; 528 $chunk_pos += $chunk_size; 705 529 my $data = encode_base64($chunk); 706 #printf("chunk : %s, data %s\n", length $chunk, length $data);707 530 my $response = $self->uagent->post( 708 531 $self->urlbase.'/ws.php?format=json', … … 710 533 method => 'pwg.images.addChunk', 711 534 data => $data, 712 original_sum => $ params->{original_sum},535 original_sum => $image->{image_id}, 713 536 position => $chunk_id, 714 type => $ params->{type},537 type => $image->{file_type_code}, 715 538 } 716 539 ); 717 #print Dumper $response; 718 $yield->(); 719 $progress->{bar}->(100*($chunk_pos/$content_length)); 720 $progress->{msg_details}->( 721 sprintf( 722 "%s : %s", 723 $progress->{current_msg}, 724 $filename 725 ) 726 ); 540 727 541 $params->{ok} = 1; 728 542 if ($response->code != 200) { … … 732 546 $params->{message} = $response->message; 733 547 $params->{code} = $response->code; 548 $image->{last_error_msg} = $response->message; 734 549 last; 735 550 } 551 printf("sending with chunk_size %s, chunk %s\n", $chunk_size, $chunk_id); 552 553 $self->log_image_progress( 554 $image, 555 sprintf("sending %s", $image->{file_type_code}), 556 100*($chunk_pos/$content_length), 557 ); 736 558 737 559 $chunk_id++; 738 560 } 739 } 561 562 $params; 563 } 564 565 566 sub get_image_file { 567 my ( $self, $image ) = @_; 568 569 my $ft = $self->image_file_type($image); 570 $image->{$ft}; 571 } 572 573 574 sub get_image_sum { 575 my ( $self, $image ) = @_; 576 577 my $ft = $self->image_file_type($image); 578 $image->{"$ft"."_checksum"}; 579 } 580 581 582 # 'site_resized_file', 'site_thumb_file', 'site_high_file' 583 sub image_file_type { 584 my ( $self, $image ) = @_; 585 586 # thumb, file, high 587 my $ftc = $image->{file_type_code}; 588 # site_thumb_file, site_resized_file, site_high_file 589 my $ft = $self->file_type->{$ftc} if defined $ftc; 590 591 $ft; 592 } 593 594 595 sub log_image_progress { 596 my ( $self, $image, $status, $value ) = @_; 597 598 $image->{status} = $status; 599 $image->{progress} = $value; 600 601 $self->log_progress_cbk->( 602 $image 603 ) if 'CODE' eq ref $self->log_progress_cbk; 604 605 } 606 607 sub add_image { 608 my ( $self, $image ) = @_; 609 610 my $form = { 611 method => 'pwg.images.add', 612 original_sum => $image->{image_id}, 613 original_filename => $image->{site_original_filename}, 614 file_sum => $image->{site_resized_file_checksum}, 615 thumbnail_sum => $image->{site_thumb_file_checksum}, 616 categories => $image->{categories}, 617 name => $image->{site_name}, 618 author => $image->{site_author}, 619 comment => $image->{site_comment}, 620 date_creation => $image->{site_img_date_creation}, 621 tag_ids => $image->{site_tags}, 622 level => $image->{privacy_level} ? 2**($image->{privacy_level} - 1) : 0, 623 }; 624 625 $form->{high_sum} = $image->{site_high_file_checksum} if $image->{upload_high}; 626 # TODO : ERROR MANAGEMENT + DOUBLE CHECK 627 $self->execute_post($form); 628 } 629 630 # $file_type_code : 'file', 'thumb', 'high' 631 sub add_image_file_type { 632 my ( $self, $image, $file_type_code ) = @_; 633 634 $image->{file_type_code} = $file_type_code; 635 636 $self->send_image_chunks($image); 637 638 my $form = { 639 method => 'pwg.images.addFile', 640 image_id => $image->{pwg_image_id}, 641 type => $file_type_code, 642 sum => $self->get_image_sum($image), 643 }; 644 645 $self->execute_post($form); 646 my $hresult = $self->json_response_content; 647 my $rval = 'ok' eq $hresult->{stat} ? $hresult->{result} : undef; 648 649 $rval; 650 } 651 652 sub add_categories{ 653 my ( $self, $name, $parentid ) = @_; 654 655 my $form = { 656 method => 'pwg.categories.add', 657 name => $name, 658 parent => $parentid, 659 660 }; 661 662 return ( $self->execute_post($form), $self->json_response_content ); 663 } 664 665 sub set_info_category{ 666 my ( $self, $name, $comment, $parentid ) = @_; 667 668 my $form = { 669 method => 'pwg.categories.setInfo', 670 name => $name, 671 comment => $comment, 672 category_id => $parentid, 673 674 }; 675 676 return ( $self->execute_post($form), $self->json_response_content ); 677 } 678 679 740 680 741 681 742 682 1; 743
Note: See TracChangeset
for help on using the changeset viewer.