Changeset 431
- Timestamp:
- 09/19/07 20:21:33 (14 months ago)
- Location:
- HatenaBookmarker/trunk/HatenaBookmarker
- Files:
-
- 2 modified
-
HatenaBookmarker.pl (modified) (4 diffs)
-
lib/HatenaBookmarker/L10N/ja.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
HatenaBookmarker/trunk/HatenaBookmarker/HatenaBookmarker.pl
r430 r431 35 35 sub init_registry { 36 36 my $plugin = shift; 37 my $callbacks; 38 if (MT->instance->isa('MT::App::CMS')) { 39 $callbacks = { 'cms_post_save.entry' => \&cms_post_save_entry }; 40 } else { 41 $callbacks = { 'MT::Entry::post_save' => \&post_save_entry }; 37 if (!MT->instance->isa('MT::App::CMS')) { 38 $plugin->registry({ 39 callbacks => { 40 'MT::Entry::post_save' => \&post_save_entry 41 } 42 }); 43 return; 42 44 } 43 45 $plugin->registry({ 44 callbacks => $callbacks 46 callbacks => { 47 'cms_post_save.entry' => \&cms_post_save_entry 48 }, 49 applications => { 50 cms => { 51 list_actions => { 52 entry => { 53 bookmark_entry => { 54 label => $plugin->translate('Bookmark Entries'), 55 continue_prompt => $plugin->translate('Are you sure you want to bookmark the selected entries?'), 56 code => \&bookmark_entries, 57 permission => 'create_post', 58 } 59 }, 60 page => { 61 bookmark_page => { 62 label => $plugin->translate('Bookmark Pages'), 63 continue_prompt => $plugin->translate('Are you sure you want to bookmark the selected pages?'), 64 code => \&bookmark_entries, 65 permission => 'create_post', 66 } 67 }, 68 } 69 } 70 } 45 71 }); 46 72 } … … 51 77 return unless $entry->isa('MT::Entry') && $entry->status == MT::Entry::RELEASE(); 52 78 MT::Util::start_background_task( 53 sub { do_bookmark(MT->instance, $entry) }79 sub { bookmark_entry(MT->instance, $entry) } 54 80 ); 55 81 } … … 60 86 return unless $entry->isa('MT::Entry') && $entry->status == MT::Entry::RELEASE(); 61 87 MT::Util::start_background_task( 62 sub { do_bookmark($app, $entry) }88 sub { bookmark_entry($app, $entry) } 63 89 ); 90 } 91 92 sub bookmark_entries { 93 my $app = shift; 94 my $perms = $app->permissions; 95 return $app->trans_error('Permission Denied.') 96 unless $perms && $perms->can_create_post; 97 98 my $type = $app->param('_type') || 'entry'; 99 my $class = MT->model($type); 100 101 my @entry_ids = $app->param('id') 102 or return $app->error($plugin->translate('No [_1] was selected to bookmark.', $type)); 103 for my $entry_id (@entry_ids) { 104 my $entry = $class->load($entry_id) 105 or return $app->error($plugin->translate('Invalid entry_id')); 106 bookmark_entry($app, $entry) 107 if $entry->status == MT::Entry::RELEASE(); 108 } 109 $app->call_return; 64 110 } 65 111 … … 68 114 use HatenaBookmarker::Client; 69 115 70 sub do_bookmark{116 sub bookmark_entry { 71 117 my ($app, $entry) = @_; 72 118 -
HatenaBookmarker/trunk/HatenaBookmarker/lib/HatenaBookmarker/L10N/ja.pm
r430 r431 14 14 'Hatena Username' => 'はてなIDのユーザ名', 15 15 'Hatena Password' => 'はてなIDのパスワード', 16 'Bookmark Entries' => 'ブログ記事のブックマーク', 17 'Are you sure you want to bookmark the selected entries?' => '選択したブログ記事をブックマークしてよろしいですか?', 18 'Bookmark Pages' => 'ウェブページのブックマーク', 19 'Are you sure you want to bookmark the selected entries?' => '選択したウェブページをブックマークしてよろしいですか?', 16 20 ); 17 21
![(please configure the [header_logo] section in trac.ini)](/public/chrome/common/trac_banner.png)