Changeset 964

Show
Ignore:
Timestamp:
08/18/08 15:05:07 (3 months ago)
Author:
arvind
Message:

* Switching to a config.yaml (changed the definition of connectors to be more concise)
* Prevented CrossPoster? objects from installing meta tables

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CrossPoster/plugins/CrossPoster/lib/CrossPoster/Account.pm

    r938 r964  
    2525        blog_id => 1, 
    2626    }, 
    27         meta => 1, 
    2827    primary_key => 'id', 
    2928    datasource => 'crossposter_account', 
  • trunk/CrossPoster/plugins/CrossPoster/lib/CrossPoster/App/CMS.pm

    r938 r964  
    77use MT::Util qw( encode_url start_background_task ); 
    88 
     9sub load_crossposter_list_filters { 
     10    my $plugin = MT->component('CrossPoster'); 
     11    my %filters; 
     12    my $connectors = MT->registry('crossposter_connectors'); 
     13    foreach my $connector_key ( keys %$connectors ) { 
     14        $filters{$connector_key} = { 
     15            label   => $plugin->translate('[_1] Accounts', $connectors->{$connector_key}->{label}), 
     16            handler => sub { 
     17                my ( $terms, $args ) = @_; 
     18                $terms->{connector_key} = $connector_key; 
     19            }, 
     20        }; 
     21    } 
     22    my @connectors = 
     23      sort { $filters{$a}{label} cmp $filters{$b}{label} } keys %filters; 
     24    my $order = 100; 
     25    foreach (@connectors) { 
     26        $filters{$_}{order} = $order; 
     27        $order += 100; 
     28    } 
     29    return \%filters; 
     30} 
     31 
    932sub list_crossposting_account { 
    10     my $plugin = shift; 
    1133    my ($app) = @_; 
    1234    my $q = $app->param; 
     35    my $plugin = MT->component('CrossPoster'); 
    1336    my $blog_id = $q->param('blog_id'); 
    1437     
     
    4972 
    5073sub edit_crossposting_account { 
    51     my $plugin = shift; 
    52     my ($app) = @_; 
    53      
     74    my ($app) = @_;     
    5475    my $q = $app->param; 
     76    my $plugin = MT->component('CrossPoster'); 
    5577    my $blog_id = $app->param('blog_id'); 
    5678    my $id = $app->param('id');  
     
    90112 
    91113sub _cfg_content_nav { 
    92     my $plugin = shift; 
    93114    my ($cb, $app, $tmpl) = @_; 
    94115    my $old = qq{</ul>}; 
     
    102123 
    103124sub _edit_entry_param { 
    104     my $plugin = shift; 
    105125    my ($cb, $app, $param, $tmpl) = @_; 
     126    my $plugin = MT->component('CrossPoster'); 
    106127     
    107128    my $blog_id = $app->param('blog_id'); 
     
    199220 
    200221sub post_save_account { 
    201     my $plugin = shift; 
    202222    my ($cb, $account) = @_; 
    203223    my $app = MT->instance; 
     224    my $plugin = MT->component('CrossPoster'); 
    204225     
    205226    my $connector_class = $account->connector->{class}; 
     
    214235 
    215236sub CMSPostSave_entry { 
    216     my $plugin = shift; 
    217237    my ($cb, $app, $entry) = @_; 
     238    my $plugin = MT->component('CrossPoster'); 
    218239     
    219240    my @param = $app->param(); 
     
    232253 
    233254sub _cross_post { 
    234     my ($plugin, $cb, $app, $entry, $account_id) = @_; 
     255    my ($cb, $app, $entry, $account_id) = @_; 
     256    my $plugin = MT->component('CrossPoster'); 
    235257    my ($username, $passwd, $api_url, $content, $xml_entry, $api_response); 
    236258 
  • trunk/CrossPoster/plugins/CrossPoster/lib/CrossPoster/Cache.pm

    r938 r964  
    2020                entry_id => 1 
    2121    }, 
    22         meta => 1, 
    2322        audit => 1, 
    2423    primary_key => 'id',