Changeset 4476 for extensions/pLoader/trunk
- Timestamp:
- Dec 12, 2009, 10:20:29 PM (15 years ago)
- Location:
- extensions/pLoader/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/locale/fr_FR/pLoader.po
r4467 r4476 577 577 msgid "Photo update management" 578 578 msgstr "Gestion de la mise à jour des photos" 579 580 msgid "Who can see the photo? :" 581 msgstr "Qui peut voir la photo ? :" 582 583 msgid "everybody" 584 msgstr "tout le monde" 585 586 msgid "contacts" 587 msgstr "contacts" 588 589 msgid "friends" 590 msgstr "amis" 591 592 msgid "family" 593 msgstr "famille" 594 595 msgid "admins" 596 msgstr "administrateurs" 597 598 msgid "What shall we do with privacy level?" 599 msgstr "Que faire pour le niveau de confidentialité ?" -
extensions/pLoader/trunk/res/photo_properties_wdr.pl
r4475 r4476 27 27 use vars qw($CAPTION); $CAPTION = 10000; 28 28 use vars qw($PHOTO_PROPERTIES_CAPTION); $PHOTO_PROPERTIES_CAPTION = 10001; 29 use vars qw($ COMMENT); $COMMENT= 10002;30 use vars qw($PHOTO_PROPERTIES_ COMMENT); $PHOTO_PROPERTIES_COMMENT= 10003;31 use vars qw($ AUTHOR); $AUTHOR= 10004;32 use vars qw($PHOTO_PROPERTIES_ AUTHOR); $PHOTO_PROPERTIES_AUTHOR= 10005;29 use vars qw($AUTHOR); $AUTHOR = 10002; 30 use vars qw($PHOTO_PROPERTIES_AUTHOR); $PHOTO_PROPERTIES_AUTHOR = 10003; 31 use vars qw($COMMENT); $COMMENT = 10004; 32 use vars qw($PHOTO_PROPERTIES_COMMENT); $PHOTO_PROPERTIES_COMMENT = 10005; 33 33 use vars qw($CREATE_DATE); $CREATE_DATE = 10006; 34 34 use vars qw($PHOTO_PROPERTIES_CREATE_DATE); $PHOTO_PROPERTIES_CREATE_DATE = 10007; 35 35 use vars qw($TAGS); $TAGS = 10008; 36 36 use vars qw($PHOTO_PROPERTIES_TAG); $PHOTO_PROPERTIES_TAG = 10009; 37 use vars qw($PRIVACY_LEVEL); $PRIVACY_LEVEL = 10010; 38 use vars qw($PHOTO_PROPERTIES_PRIVACY_LEVEL); $PHOTO_PROPERTIES_PRIVACY_LEVEL = 10011; 37 39 38 40 sub PhotoProperties { 39 41 my( $parent ) = $_[0]; 40 my( $item0 ) = Wx::BoxSizer->new( wx HORIZONTAL );42 my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL ); 41 43 42 my( $item1 ) = Wx::BoxSizer->new( wx VERTICAL );44 my( $item1 ) = Wx::BoxSizer->new( wxHORIZONTAL ); 43 45 44 46 my( $item2 ) = Wx::BoxSizer->new( wxVERTICAL ); 45 47 46 my( $item3 ) = Wx::BoxSizer->new( wxVERTICAL ); 47 48 my( $item4 ) = Wx::StaticText->new( $parent, $main::CAPTION, "text", wxDefaultPosition, wxDefaultSize, 0 ); 49 $item3->AddWindow( $item4, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); 48 my( $item3 ) = Wx::StaticText->new( $parent, $main::CAPTION, "text", wxDefaultPosition, wxDefaultSize, 0 ); 49 $item2->AddWindow( $item3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 50 50 51 my( $item 5) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CAPTION, "", wxDefaultPosition, [200,-1], 0 );52 $item 3->AddWindow( $item5, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP, 5 );51 my( $item4 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CAPTION, "", wxDefaultPosition, [200,-1], 0 ); 52 $item2->AddWindow( $item4, 0, wxALIGN_CENTER_VERTICAL, 5 ); 53 53 54 $item2->Add( $item3, 0, wxALIGN_CENTER|wxALL, 5 ); 54 my( $item5 ) = Wx::StaticText->new( $parent, $main::AUTHOR, "text", wxDefaultPosition, wxDefaultSize, 0 ); 55 $item2->AddWindow( $item5, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 55 56 56 my( $item6 ) = Wx::BoxSizer->new( wxVERTICAL ); 57 57 my( $item6 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_AUTHOR, "", wxDefaultPosition, [200,-1], 0 ); 58 $item2->AddWindow( $item6, 0, wxALIGN_CENTER, 5 ); 59 58 60 my( $item7 ) = Wx::StaticText->new( $parent, $main::COMMENT, "text", wxDefaultPosition, wxDefaultSize, 0 ); 59 $item 6->AddWindow( $item7, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );61 $item2->AddWindow( $item7, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 60 62 61 63 my( $item8 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_COMMENT, "", wxDefaultPosition, [200,100], wxTE_MULTILINE ); 62 $item 6->AddWindow( $item8, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );64 $item2->AddWindow( $item8, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 63 65 64 $item2->Add( $item6, 0, wxALIGN_CENTER_VERTICAL, 5 ); 66 my( $item9 ) = Wx::StaticText->new( $parent, $main::CREATE_DATE, "text", wxDefaultPosition, wxDefaultSize, 0 ); 67 $item2->AddWindow( $item9, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 65 68 66 my( $item9 ) = Wx::BoxSizer->new( wxVERTICAL ); 69 my( $item10 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, "", wxDefaultPosition, [200,-1], 0 ); 70 $item2->AddWindow( $item10, 0, wxALIGN_CENTER_VERTICAL, 5 ); 71 72 $item1->Add( $item2, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); 73 74 my( $item11 ) = Wx::BoxSizer->new( wxVERTICAL ); 67 75 68 my( $item10 ) = Wx::StaticText->new( $parent, $main::AUTHOR, "text", wxDefaultPosition, wxDefaultSize, 0 ); 69 $item9->AddWindow( $item10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); 70 71 my( $item11 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_AUTHOR, "", wxDefaultPosition, [200,-1], 0 ); 72 $item9->AddWindow( $item11, 0, wxALIGN_CENTER|wxRIGHT|wxTOP, 5 ); 73 74 $item2->Add( $item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 75 76 my( $item12 ) = Wx::BoxSizer->new( wxVERTICAL ); 77 78 my( $item13 ) = Wx::StaticText->new( $parent, $main::CREATE_DATE, "text", wxDefaultPosition, wxDefaultSize, 0 ); 79 $item12->AddWindow( $item13, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); 80 81 my( $item14 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, "", wxDefaultPosition, [200,-1], 0 ); 82 $item12->AddWindow( $item14, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5 ); 83 84 $item2->Add( $item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 85 86 $item1->Add( $item2, 0, wxALIGN_CENTER|wxALL, 5 ); 87 88 my( $item15 ) = Wx::BoxSizer->new( wxVERTICAL ); 89 90 $item1->Add( $item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 91 92 my( $item16 ) = Wx::BoxSizer->new( wxVERTICAL ); 93 94 $item1->Add( $item16, 0, wxALIGN_CENTER|wxALL, 5 ); 95 96 $item0->Add( $item1, 0, wxALL, 5 ); 97 98 my( $item17 ) = Wx::BoxSizer->new( wxVERTICAL ); 99 100 my( $item18 ) = Wx::StaticText->new( $parent, $main::TAGS, "text", wxDefaultPosition, wxDefaultSize, 0 ); 101 $item17->AddWindow( $item18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 76 my( $item12 ) = Wx::StaticText->new( $parent, $main::TAGS, "text", wxDefaultPosition, wxDefaultSize, 0 ); 77 $item11->AddWindow( $item12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 102 78 103 79 my $tags = $_[1]; 104 80 $tags->{parentwnd}=$parent; 105 my( $item1 9) = Uploader::GUI::wxChoiceFilteredPanel->new($tags);106 $item1 7->AddWindow( $item19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );81 my( $item13 ) = Uploader::GUI::wxChoiceFilteredPanel->new($tags); 82 $item11->AddWindow( $item13, 0, wxALIGN_CENTER_VERTICAL, 5 ); 107 83 108 $item0->Add( $item17, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); 84 $item1->Add( $item11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0 ); 85 86 $item0->Add( $item1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 87 88 my( $item14 ) = Wx::BoxSizer->new( wxHORIZONTAL ); 89 90 my( $item15 ) = Wx::BoxSizer->new( wxVERTICAL ); 91 92 my( $item16 ) = Wx::StaticText->new( $parent, $main::PRIVACY_LEVEL, "text", wxDefaultPosition, wxDefaultSize, 0 ); 93 $item15->AddWindow( $item16, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); 94 95 my( $item17 ) = Wx::Choice->new( $parent, $main::PHOTO_PROPERTIES_PRIVACY_LEVEL, wxDefaultPosition, [520,-1], [], 0 ); 96 $item15->AddWindow( $item17, 0, wxALIGN_CENTER_VERTICAL, 5 ); 97 98 $item14->Add( $item15, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); 99 100 $item0->Add( $item14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 109 101 110 102 my( $set_size ) = @_ >= 3 ? $_[2] : 1; -
extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
r4475 r4476 18 18 my $ctrl_handlers = { 19 19 'Wx::TextCtrl' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_TEXT( $ctrl, $ctrl, sub { $self->OnTextCtrl(@_) } ); }, 20 'Wx::Choice' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_CHOICE( $ctrl, $ctrl, sub { $self->OnChoice(@_) } ); }, 20 21 }; 21 22 … … 35 36 my ( $self, $ctrl, $event ) = @_; 36 37 37 printf("OnTextCtrl %s, %s\n", $ctrl->GetId, $event->GetString);38 38 my $id = $ctrl->GetId; 39 39 # change the property value … … 47 47 48 48 } 49 50 sub OnChoice { 51 my ( $self, $ctrl, $event ) = @_; 52 53 my $id = $ctrl->GetId; 54 # change the property value 55 $self->properties->{$id}->{selection}->( 56 $event->GetSelection 57 ) if exists $self->properties->{$id}->{selection}; 58 59 # exec the callback 60 $self->properties->{$id}->{frame_callback}->() if exists 61 $self->properties->{$id}->{frame_callback}; 62 63 } 64 49 65 50 66 my $change_value = { … … 98 114 } 99 115 116 sub InitChoices { 117 my ( $self ) = @_; 118 119 map { 120 my $ctrl =$self->FindWindow($_); 121 #printf("ctrl %s : %s\n", $_, $ctrl); 122 if(defined $ctrl){ 123 # choice 124 my $choices =$self->properties->{$_}->{choices}; 125 $choices||=[]; 126 map{ 127 $ctrl->Append($_); 128 }@$choices; 129 } 130 } 131 keys %{$self->properties}; 132 133 } 134 100 135 sub GetProperties { 101 136 my ( $self ) = @_; … … 115 150 ) if exists $self->properties->{$_}->{selection}; 116 151 152 printf("selection %s\n", $ctrl->GetSelection())if exists $self->properties->{$_}->{selection}; 153 117 154 } 118 155 } -
extensions/pLoader/trunk/src/Uploader/GUI/wxApp.pm
r4467 r4476 111 111 upload_hd 112 112 eng_upload_hd 113 privacy_level 113 114 / 114 115 ); … … 303 304 } 304 305 ); 306 307 # hard coded because the piwigo api to read custom privacy level is not yet available 308 $self->privacy_level( 309 [ 310 'everybody', 311 'contacts', 312 'friends', 313 'family', 314 'admins' 315 ] 316 ); 317 318 319 } 320 321 # display privacy level list in a pyramid way : 322 # ['everybody', 'contacts', friends, family, admins] -> [everybody, 'contacts, friends, family, admins', 'friends, family, admins', 'family, admins', 'admins only' ] 323 sub privacy_level_choices{ 324 my ( $self ) = @_; 325 326 my $pl = $self->privacy_level; 327 my $n = scalar @$pl - 1; 328 my $list = [ gettext($pl->[0]) ]; 329 my $i=0; 330 while(++$i<$n){ 331 push @$list, join( 332 ', ', 333 map{ gettext($_) } 334 @$pl[$i..$n] 335 ); 336 } 337 push @$list, gettext($pl->[$n]); 338 339 $list; 305 340 } 306 341 … … 429 464 Wx::LogMessage( 430 465 gettext("An error has occured. Can not read %s\n%s"), 431 $self->storable_file, 466 $self->storable_file, 432 467 $@ 433 468 ); -
extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm
r4475 r4476 348 348 value => sub { $self->imagelist->current_image->create_date(@_) }, 349 349 }, 350 $main::PRIVACY_LEVEL => { label=>gettext("Privacy level :")}, 350 $main::PRIVACY_LEVEL => { label=>gettext("Who can see the photo? :")}, 351 $main::PHOTO_PROPERTIES_PRIVACY_LEVEL => { 352 selection => sub { $self->imagelist->current_image->privacy_level(@_)}, 353 choices => wxTheApp->privacy_level_choices, , 354 }, 351 355 } 352 356 ); -
extensions/pLoader/trunk/src/Uploader/GUI/wxPhotoProperties.pm
r4475 r4476 55 55 #$self->_init_values; 56 56 $self->InitLabels(); 57 $self->InitChoices(); 57 58 $self->SetProperties(); 58 59 $self->InitHandler(); -
extensions/pLoader/trunk/src/Uploader/Image.pm
r4408 r4476 39 39 width 40 40 height 41 privacy_level 41 42 / 42 43 ); -
extensions/pLoader/trunk/src/Uploader/ImageList.pm
r4467 r4476 1263 1263 my ( $self ) = @_; 1264 1264 1265 1265 1266 $self->pwg->reupload_action_files( 1266 1267 $self->reupload_action_files||1 … … 1306 1307 ); 1307 1308 1309 $self->pwg->privacy_level( 1310 $self->current_image->privacy_level 1311 ); 1312 1308 1313 $self->current_image->site_categories( 1309 1314 $self->categories -
extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm
r4467 r4476 69 69 single_value_mode 70 70 multiple_value_mode 71 privacy_level 71 72 / 72 73 ); … … 170 171 # when server response has warnings, the content response is not a valid json string 171 172 # find the json response 172 #printf("%s\n", $self->uagent_response->content);173 173 $self->uagent_response->content =~ /(\{.+\})/; 174 174 #printf("json response %s\n", $1); … … 181 181 } 182 182 else{ 183 $hresult = {183 $hresult = { 184 184 'message' => $self->uagent_response->message, 185 185 'stat' => 'fail', … … 306 306 307 307 $progress->{yield}->(); 308 ( $status, $status_line ) = $self->_execute_post($form); 308 ( $status, $status_line ) = $self->_execute_post($form); 309 309 } 310 310 # re-upload 311 311 else{ 312 #printf("reupload, files %s, properties %s\n", $self->reupload_action_files, $self->reupload_action_properties);313 312 # need to check if files have changed 314 313 # and update image info … … 327 326 # update metadata info 328 327 if($self->reupload_action_properties){ 329 330 $form->{name} = $self->site_image_name;328 #printf("reupload_action_properties %s\n", $self->reupload_action_properties); 329 $form->{name} = $self->site_image_name; 331 330 $form->{author} = $self->site_author; 332 331 $form->{comment} = $self->site_comment; 333 332 $form->{date_creation} = $self->site_img_date_creation; 334 333 $form->{single_value_mode} = $self->single_value_mode->{$self->reupload_action_properties}; 334 $form->{level} = $self->privacy_level ? 2**($self->privacy_level - 1) : 0; 335 335 } 336 336 if($self->reupload_action_properties_m){ … … 342 342 $progress->{yield}->(); 343 343 ( $status, $status_line ) = $self->_execute_post($form); 344 } 344 345 } 345 346 346 347 delete $form->{tag_ids} unless defined $self->site_tags; … … 348 349 349 350 $progress->{yield}->(); 350 #print "form ", Dumper $form; 351 #print "status ", $status, "\n"; 352 #print "status_line ", $status_line, "\n"; 353 # basic check, should perform a checkfile 354 $content->{stat} = !$self->_exists($progress->{original_sum}) ? 'fail' : 'ok'; 351 # for first upload 352 if($doubleCheck){ 353 $self->image_id( 354 $self->_exists($progress->{original_sum}) 355 ); 356 $content->{stat} = !defined $self->image_id ? 'fail' : 'ok'; 357 if(defined $self->image_id and defined $self->privacy_level){ 358 ( $status, $status_line, $content ) = $self->_set_privacy_level; 359 } 360 } 355 361 356 362 last UPLOAD; … … 358 364 359 365 return ( $status, $status_line, $content); 366 } 367 368 sub _set_privacy_level { 369 my ( $self ) = @_; 370 371 my $form = { 372 method => 'pwg.images.setPrivacyLevel', 373 image_id => $self->image_id, 374 level => $self->privacy_level ? 2**($self->privacy_level - 1) : 0, 375 }; 376 print Dumper $form; 377 my ( $status, $status_line ) = $self->_execute_post($form); 378 my $hresult = $self->_json_response_content; 379 380 ($status, $status_line, $hresult ); 360 381 } 361 382 … … 443 464 $self->_execute_post($form); 444 465 my $hresult = $self->_json_response_content; 445 print Dumper $hresult; 466 446 467 my $rval = 'ok' eq $hresult->{stat} ? $hresult->{result} : undef; 447 468
Note: See TracChangeset
for help on using the changeset viewer.