Changeset 965

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

* Updated UI to match MT 4.2 and the new connectors registry hash
* Added transformer callbacks to config.yaml

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CrossPoster/plugins/CrossPoster/config.yaml

    r964 r965  
    2525            label: Vox URL 
    2626            hint: A URL to your Vox blog 
     27            default: http:// 
    2728    MovableType: 
    2829        class: CrossPoster::Connector::MovableType 
     
    3536        url: 
    3637            label: Blog URL 
    37             hint: A URL to your Movable Type blog     
     38            hint: A URL to your Movable Type blog 
     39            default: http://     
    3840    LiveJournal: 
    3941        class: CrossPoster::Connector::LiveJournal 
     
    6769        list_filters: 
    6870            crossposter_account: $CrossPoster::CrossPoster::App::CMS::load_crossposter_list_filters 
     71        callbacks: 
     72            template_source.cfg_content_nav: $CrossPoster::CrossPoster::App::CMS::_cfg_content_nav 
     73            template_param.edit_entry: $CrossPoster::CrossPoster::App::CMS::_edit_entry_param 
  • trunk/CrossPoster/plugins/CrossPoster/lib/CrossPoster/App/CMS.pm

    r964 r965  
    9595        $row->{key} = $key; 
    9696        delete $row->{plugin}; 
    97         foreach my $k (keys %$row) { 
    98             my $value = $row->{$k}; 
    99             if (ref($value) eq 'CODE') { # handle coderefs 
    100                 $value = $value->(@_); 
    101             } 
    102             $row->{$k} = $value; 
    103         } 
     97        _registry_code_value($row); 
    10498        push @connectors_loop, $row; 
    10599    } 
     
    116110    $old = quotemeta($old); 
    117111    my $new = <<HTML; 
    118 <li<mt:if name="crossposting_accounts"> class="active"</mt:if>><a href="<mt:var name="script_url">?__mode=list_crossposting_account&amp;blog_id=<mt:var name="blog_id">"><__trans phrase="Crossposting"></a></li>    
     112<li<mt:if name="crossposting_accounts"> class="active"</mt:if>><a href="<mt:var name="script_url">?__mode=list_crossposting_account&amp;blog_id=<mt:var name="blog_id">"><b><__trans phrase="Crossposting"></b></a></li>    
    119113HTML 
    120114 
     
    412406} 
    413407 
     408# Recursively loop through a registry hashref and if the value is a coderef, 
     409# execute it so that we get a value 
     410sub _registry_code_value { 
     411    my ($hash) = @_; 
     412     
     413    foreach my $key (keys %$hash) { 
     414        if(ref $hash->{$key} eq 'HASH') { 
     415            _registry_code_value($hash->{$key}) 
     416        } elsif(ref $hash->{$key} eq 'CODE') { 
     417            $hash->{$key} = $hash->{$key}->(); 
     418        } 
     419    } 
     420} 
     421 
    4144221; 
  • trunk/CrossPoster/plugins/CrossPoster/tmpl/edit_account.tmpl

    r938 r965  
    88         
    99        <style type="text/css"> 
    10        .dialog-4 #container, .dialog-4 #content { overflow: visible; } 
    11        .dialog-4 .actions-bar { position: static;
     10        .field-content { margin-left: 130px; } 
     11        .threequarter-width { width: 75%;
    1212        </style> 
    1313        <script type="text/javascript"> 
     
    5757                } 
    5858                 
    59                 if(!connector.username_label) 
    60                         connector.username_label = '<__trans phrase="Username">'; 
    61                          
    62                 if(!connector.password_label) 
    63                         connector.password_label = '<__trans phrase="Password">'; 
    64                          
    65                 if(!connector.url_label) 
    66                         connector.url_label = '<__trans phrase="Blog URL">'; 
    67                  
    6859                var fields = new Array('username', 'password', 'url'); 
    6960                 
    7061                for (var i = 0; i < fields.length; i++) { 
    7162                        var field = fields[i]; 
    72                         var required = field + '_required'; 
    73                         var label = field + '_label'; 
    74                         var hint = field + '_hint'; 
    75  
    76                         if(connector[required]) { 
    77                                 show(field + '-field'); 
    78                                  
    79                                 if(connector[label]) 
    80                                         getByID(field + '-label').innerHTML = connector[label]; 
    81                                          
    82                                 if(connector[hint])      
    83                                         DOM.getElementsByClassName(getByID(field + '-field'), 'hint')[0].innerHTML = connector[hint]; 
    84  
     63                         
     64                        if(connector[field]) { 
     65                            show(field + '-field'); 
     66                             
     67                        if(connector[field].label) 
     68                        getByID(field + '-label').innerHTML = connector[field].label; 
     69                         
     70                DOM.getElementsByClassName(getByID(field + '-field'), 'hint')[0].innerHTML = (connector[field].hint || ''); 
     71                 
     72                <mt:unless name="id">getByID(field).value = (connector[field].default || '');</mt:unless> 
     73                 
    8574                        } else { 
    86                                hide(field + '-field'); 
     75                            hide(field + '-field'); 
    8776                        } 
    8877                } 
     
    142131                show_hint="0"> 
    143132                 
    144                 <input type="text" name="name" value="<mt:var name="name">" id="name" class="full-width" /> 
     133                <input type="text" name="name" value="<mt:var name="name">" id="name" class="threequarter-width" /> 
    145134                         
    146135        </mtapp:setting> 
     
    152141                show_hint="1"> 
    153142                 
    154                 <input type="text" name="username" value="<mt:var name="username">" id="username" class="full-width" /> 
     143                <input type="text" name="username" value="<mt:var name="username">" id="username" class="threequarter-width" /> 
    155144                         
    156145        </mtapp:setting> 
     
    162151                show_hint="1"> 
    163152                 
    164                 <input type="password" name="passwd" value="<mt:var name="passwd">" id="password" class="full-width" /> 
     153                <input type="password" name="passwd" value="<mt:var name="passwd">" id="password" class="threequarter-width" /> 
    165154                         
    166155                <br /><a href="#" onclick="revealPassword();"><__trans phrase="Reveal Password"></a> 
     
    174163                show_hint="1"> 
    175164                 
    176                 <input type="text" name="url" value="<mt:var name="url">" id="url" class="full-width" /> 
     165                <input type="text" name="url" value="<mt:var name="url">" id="url" class="threequarter-width" /> 
    177166                         
    178167        </mtapp:setting> 
  • trunk/CrossPoster/plugins/CrossPoster/tmpl/list_account.tmpl

    r938 r965  
    5151//--> 
    5252</script> 
     53<style type="text/css"> 
     54.content-nav #content-header #create-new-link { 
     55    margin-left: 140px; 
     56    padding-left: 20px; 
     57} 
     58</style> 
    5359</mt:setvarblock> 
    5460<mt:setvarblock name="list_filter_form"> 
     
    7783    <mt:include name="include/cfg_content_nav.tmpl"> 
    7884</mt:setvarblock> 
     85<mt:setvarblock name="content_header"> 
     86    <p id="create-new-link"><a href="#" onclick="return openDialog(this.form, 'edit_crossposting_account', 'blog_id=<mt:var name="blog_id">')" class="icon-left icon-create"><__trans phrase="New Crossposting Account"></a></p> 
     87</mt:setvarblock> 
    7988<mt:include name="include/header.tmpl"> 
    80  
    81 <p><a href="#" onclick="return openDialog(this.form, 'edit_crossposting_account', 'blog_id=<mt:var name="blog_id">')" class="icon-left icon-create"><__trans phrase="New Crossposting Account"></a></p> 
    8289         
    8390<mt:var name="list_filter_form">