Dotclear

Changeset 1392:f654316f6e43


Ignore:
Timestamp:
08/16/13 10:39:47 (11 years ago)
Author:
Dsls
Branch:
default
Message:
  • Added foldable sidebar entries,
  • Added new behavior : adminPostFormSidebarItems
  • Sidebar entries are now manageable from plugins

see #1533

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_post.js

    r1353 r1392  
    122122               hide: $('#post_password').val() == '' 
    123123          }); 
    124            
     124          $('#post_status').parent().toggleWithLegend($('#post_status'),{ 
     125               cookie: 'dcx_post_status' 
     126          }); 
     127          $('#post_dt').parent().toggleWithLegend($('#post_dt').parent().children().not('label'),{ 
     128               cookie: 'dcx_post_dt' 
     129          }); 
     130          $('#post_format').parent().toggleWithLegend($('#post_format').parent().children().not('label').add($('#post_format').parents('p').next()),{ 
     131               cookie: 'dcx_post_format' 
     132          }); 
     133          $('#cat_id').parent().toggleWithLegend($('#cat_id'),{ 
     134               cookie: 'cat_id' 
     135          }); 
     136          $('#post_url').parent().toggleWithLegend($('#post_url').parent().children().not('label'),{ 
     137               cookie: 'post_url' 
     138          }); 
    125139          // We load toolbar on excerpt only when it's ready 
    126140          $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 
  • admin/post.php

    r1365 r1392  
    445445     echo '<div id="entry-sidebar">'; 
    446446      
    447      echo 
    448      '<div id="status-box" class="box">'. 
    449      '<h4>Statut</h4>'. 
    450  
    451      '<p><label for="post_status">'.__('Entry status:'). 
    452      form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 
    453      '</label></p>'. 
    454       
    455      '<p><label for="post_dt">'.__('Published on:'). 
    456      form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    457      '</label></p>'. 
    458       
    459      '<p><label for="post_format">'.__('Text formating:'). 
    460      form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
    461      '</label>'. 
    462      '</p>'. 
    463  
    464      '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button maximal" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    465  
    466      '<p><label for="post_lang">'.__('Entry lang:'). 
    467      form::combo('post_lang',$lang_combo,$post_lang). 
    468      '</label></p>'. 
    469       
    470      '</div>'. // End status box 
    471       
    472      '<div id="metas-box" class="box">'. 
    473      '<h4>Classement</h4>'. 
    474  
    475      '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    476      __('Selected entry').'</label></p>'. 
    477  
    478      '<p><label for="cat_id">'.__('Category:'). 
    479      form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    480      '</label></p>'. 
    481  
    482      '</div>'. // End metas box 
    483       
    484      '<div id="options-box" class="box">'. 
    485      '<h4>Options</h4>'. 
    486      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    487      __('Accept comments').'</label></p>'. 
    488      ($core->blog->settings->system->allow_comments ?  
    489           (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    490                '' : 
    491                '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') :  
    492           '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 
    493  
    494      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    495      __('Accept trackbacks').'</label></p>'. 
    496      ($core->blog->settings->system->allow_trackbacks ?  
    497           (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    498                '' : 
    499                '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    500           '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 
    501  
    502      '<p><label for="post_password">'.__('Password:'). 
    503      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    504      '</label></p>'. 
    505       
    506      '<div class="lockable">'. 
    507      '<p><label for="post_url">'.__('Edit basename:'). 
    508      form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    509      '</label></p>'. 
    510      '<p class="form-note warn">'. 
    511      __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    512      '</p>'. 
    513      '</div>'; 
     447     $post_sidebar = new ArrayObject(array( 
     448          'status-box' => array( 
     449               'title' => __('Status'), 
     450               'items' => array( 
     451                    'post_status' =>  
     452                         '<p><label for="post_status">'.__('Entry status:'). 
     453                         form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 
     454                         '</label></p>', 
     455                    'post_dt' =>  
     456                         '<p><label for="post_dt">'.__('Published on:'). 
     457                         form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
     458                         '</label></p>', 
     459                    'post_lang' => 
     460                         '<p><label for="post_lang">'.__('Entry lang:'). 
     461                         form::combo('post_lang',$lang_combo,$post_lang). 
     462                         '</label></p>', 
     463                    'post_format' => 
     464                         '<p><label for="post_format">'.__('Text formating:'). 
     465                         form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
     466                         '</label></p>'. 
     467                         '<p>'.($post_id && $post_format != 'xhtml' ?  
     468                         '<a id="convert-xhtml" class="button maximal" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
     469                         __('Convert to XHTML').'</a>' : '').'</p>')), 
     470          'metas-box' => array( 
     471               'title' => __('Ordering'), 
     472               'items' => array( 
     473                    'post_selected' =>  
     474                         '<p><label for="post_selected" class="classic">'. 
     475                         form::checkbox('post_selected',1,$post_selected).' '. 
     476                         __('Selected entry').'</label></p>', 
     477                    'cat_id' => 
     478                         '<p><label for="cat_id">'.__('Category:'). 
     479                         form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
     480                         '</label></p>')), 
     481          'options-box' => array( 
     482               'title' => __('Options'), 
     483               'items' => array( 
     484                    'post_open_comment' => 
     485                         '<p><label for="post_open_comment" class="classic">'. 
     486                         form::checkbox('post_open_comment',1,$post_open_comment).' '. 
     487                         __('Accept comments').'</label></p>'. 
     488                         ($core->blog->settings->system->allow_comments ?  
     489                              (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
     490                                   '' : 
     491                                   '<p class="form-note warn">'. 
     492                                   __('Warning: Comments are not more accepted for this entry.').'</p>') :  
     493                              '<p class="form-note warn">'. 
     494                              __('Warning: Comments are not accepted on this blog.').'</p>'), 
     495                    'post_open_tb' => 
     496                         '<p><label for="post_open_tb" class="classic">'. 
     497                         form::checkbox('post_open_tb',1,$post_open_tb).' '. 
     498                         __('Accept trackbacks').'</label></p>'. 
     499                         ($core->blog->settings->system->allow_trackbacks ?  
     500                              (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
     501                                   '' : 
     502                                   '<p class="form-note warn">'. 
     503                                   __('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
     504                              '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'), 
     505                    'post_password' => 
     506                         '<p><label for="post_password">'.__('Password:'). 
     507                         form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
     508                         '</label></p>', 
     509                    'post_url' => 
     510                         '<div class="lockable">'. 
     511                         '<p><label for="post_url">'.__('Edit basename:'). 
     512                         form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
     513                         '</label></p>'. 
     514                         '<p class="form-note warn">'. 
     515                         __('Warning: If you set the URL manually, it may conflict with another entry.'). 
     516                         '</p></div>' 
     517     )))); 
     518     $core->callBehavior('adminPostFormSidebarItems',$post_sidebar, isset($post) ? $post : null); 
     519     foreach ($post_sidebar as $id => $c) { 
     520          echo '<div id="'.$id.'" class="box">'. 
     521               '<h4>'.$c['title'].'</h4>'; 
     522          foreach ($c['items'] as $e_name=>$e_content) { 
     523               echo $e_content; 
     524          } 
     525          echo '</div>'; 
     526     } 
     527      
    514528      
    515529     # --BEHAVIOR-- adminPostFormSidebar 
    516530     $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    517  
    518      echo '</div>'; // End options box 
    519       
    520531     echo '</div>';      // End #entry-sidebar 
    521532 
  • plugins/attachments/_admin.php

    r1365 r1392  
    1212if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1313 
    14 $core->addBehavior ('adminPostFormSidebar',array('attachmentAdmin','adminPostFormSidebar')); 
     14$core->addBehavior ('adminPostFormSidebarItems',array('attachmentAdmin','adminPostFormSidebarItems')); 
    1515$core->addBehavior ('adminPostAfterForm',array('attachmentAdmin','adminPostAfterForm')); 
     16$core->addBehavior('adminPostHeaders',array('attachmentAdmin','postHeaders')); 
    1617 
    1718class attachmentAdmin 
    1819{ 
    19      public static function adminPostFormSidebar($post)  
     20     public static function postHeaders() 
     21     { 
     22          return  
     23          '<script type="text/javascript" src="index.php?pf=attachments/js/post.js"></script>'; 
     24     } 
     25     public static function adminPostFormSidebarItems($items,$post)  
    2026     { 
    2127          if ($post !== null) 
     
    2329               $core =& $GLOBALS['core']; 
    2430               $post_media = $core->media->getPostMedia($post->post_id); 
    25                echo 
    26                '<h5 class="clear">'.__('Attachments').'</h5>'; 
     31               $item = '<h5 class="clear s-attachments">'.__('Attachments').'</h5>'; 
    2732               foreach ($post_media as $f) 
    2833               { 
     
    3136                         $ftitle = substr($ftitle,0,16).'...'; 
    3237                    } 
    33                     echo 
    34                     '<div class="media-item">'. 
     38                    $item .= 
     39                    '<div class="media-item s-attachments">'. 
    3540                    '<a class="media-icon" href="media_item.php?id='.$f->media_id.'">'. 
    3641                    '<img src="'.$f->media_icon.'" alt="" title="'.$f->basename.'" /></a>'. 
     
    5358                
    5459               if (empty($post_media)) { 
    55                     echo '<p class="form-note">'.__('No attachment.').'</p>'; 
    56                } else { 
    57                } 
    58                echo '<p><a class="button" href="media.php?post_id='.$post->post_id.'">'.__('Add files to this entry').'</a></p>'; 
     60                    $item .= '<p class="form-note s-attachments">'.__('No attachment.').'</p>'; 
     61               }  
     62               $item .= '<p class="s-attachments"><a class="button" href="media.php?post_id='.$post->post_id.'">'.__('Add files to this entry').'</a></p>'; 
     63               $items['metas-box']['items']['attachments']= $item; 
    5964          } 
    6065     } 
  • plugins/pings/_admin.php

    r1179 r1392  
    3333 
    3434$core->addBehavior('adminPostHeaders',array('pingsBehaviors','pingJS')); 
    35 $core->addBehavior('adminPostFormSidebar',array('pingsBehaviors','pingsForm')); 
     35$core->addBehavior('adminPostFormSidebarItems',array('pingsBehaviors','pingsFormItems')); 
    3636$core->addBehavior('adminAfterPostCreate',array('pingsBehaviors','doPings')); 
    3737$core->addBehavior('adminAfterPostUpdate',array('pingsBehaviors','doPings')); 
  • plugins/pings/lib.pings.php

    r1365 r1392  
    4141     } 
    4242      
    43      public static function pingsForm($post) 
     43     public static function pingsFormItems($items,$post) 
    4444     { 
    4545          $core =& $GLOBALS['core']; 
     
    5959          } 
    6060           
    61           echo '<h5 class="ping-services">'.__('Pings:').'</h5>'; 
     61          $item = '<h5 class="ping-services">'.__('Pings:').'</h5>'; 
    6262          $i = 0; 
    6363          foreach ($pings_uris as $k => $v) 
    6464          { 
    65                echo 
     65               $item .= 
    6666               '<p class="ping-services"><label for="pings_do-'.$i.'" class="classic">'. 
    6767               form::checkbox(array('pings_do[]','pings_do-'.$i),html::escapeHTML($v),in_array($v,$pings_do)).' '. 
     
    6969               $i++; 
    7070          } 
     71          $items['options-box']['items']['pings']=$item; 
     72           
    7173     } 
    7274      
  • plugins/tags/_admin.php

    r1365 r1392  
    1818require dirname(__FILE__).'/_widgets.php'; 
    1919 
    20 $core->addBehavior('adminPostFormSidebar',array('tagsBehaviors','tagsField')); 
     20$core->addBehavior('adminPostFormSidebarItems',array('tagsBehaviors','tagsField')); 
    2121 
    2222$core->addBehavior('adminAfterPostCreate',array('tagsBehaviors','setTags')); 
     
    7171     } 
    7272      
    73      public static function tagsField($post) 
     73     public static function tagsField($items,$post) 
    7474     { 
    7575          $meta =& $GLOBALS['core']->meta; 
     
    8080               $value = ($post) ? $meta->getMetaStr($post->post_meta,'tag') : ''; 
    8181          } 
    82            
    83           echo 
    84           '<h5><label for="post_tags">'.__('Tags:').'</label></h5>'. 
    85           '<div class="p" id="tags-edit">'.form::textarea('post_tags',20,3,$value,'maximal').'</div>'; 
     82          $items['metas-box']['items']['post_tags']= 
     83          '<h5><label class="s-tags" for="post_tags">'.__('Tags:').'</label></h5>'. 
     84          '<div class="p s-tags" id="tags-edit">'.form::textarea('post_tags',20,3,$value,'maximal').'</div>'; 
    8685     } 
    8786      
  • plugins/tags/_define.php

    r1179 r1392  
    1818     /* Version */            '1.2', 
    1919     array( 
    20           'permissions' =>    'usage,contentadmin' 
     20          'permissions' =>    'usage,contentadmin', 
     21          'priority' =>       998 
    2122     ) 
    2223); 
  • plugins/tags/js/post.js

    r1112 r1392  
    5858          }); 
    5959     }); 
     60                
     61     $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ 
     62               cookie: 'post_tags' 
     63     }); 
     64 
    6065}); 
    6166 
Note: See TracChangeset for help on using the changeset viewer.

Sites map