Dotclear


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

see #1533

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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     } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map