Dotclear

Changeset 537


Ignore:
Timestamp:
10/27/08 17:36:04 (15 years ago)
Author:
Moe
google:author:
appears
Message:

DL Manager 1.0-beta10 :

  • improved display in media files :

added breadcrumb and link to file's directory on media_player.html

Location:
plugins/dlManager
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • plugins/dlManager/_define.php

    r536 r537  
    2828     /* Description*/                "Download manager with a public page and a widget", 
    2929     /* Author */                    "Moe (http://gniark.net/), Osku and Tomtom (http://blog.zenstyle.fr)", 
    30      /* Version */                   '1.0-beta9', 
     30     /* Version */                   '1.0-beta10', 
    3131     /* Permissions */               'admin' 
    3232); 
  • plugins/dlManager/_public.php

    r536 r537  
    5454               # exit if the public_path (and Media root) doesn't exist 
    5555               if (!is_dir($core->blog->public_path)) {self::p404();} 
    56                 
    57                if (!is_object($core->media)) 
    58                { 
    59                     $core->media = new dcMedia($core); 
    60                } 
    61                 
     56                               
    6257               # define root of DL Manager 
    6358               $page_root = $core->blog->settings->dlmanager_root; 
     
    9085                    { 
    9186                         $dir = trim($dir); 
     87                          
     88                         # check 
     89                         if (($dir == '.') OR ($dir == '..')) {self::p404();} 
     90                          
    9291                         if (!empty($dir)) 
    9392                         { 
     
    192191          # exit if the public_path (and Media root) doesn't exist 
    193192          if (!is_dir($core->blog->public_path)) {self::p404();} 
    194            
    195           if (!is_object($core->media)) 
    196           { 
    197                $core->media = new dcMedia($core); 
    198           } 
    199            
     193                     
    200194          $file = $core->media->getFile($args); 
    201195           
    202           if (empty($file->file)) 
     196          if ((empty($file->file)) || (!is_readable($file->file))) 
    203197          { 
    204198               self::p404(); 
    205199          } 
    206       
     200           
     201          $_ctx->dlManager_item = $file; 
     202          $_ctx->file_url = $file->file_url; 
     203                
     204          # define root of DL Manager 
    207205          $page_root = $core->blog->settings->dlmanager_root; 
    208206           
     207          # used to remove root from path 
     208          $page_root_len = strlen($page_root); 
     209           
     210          # remove slash at the beginning of the string 
     211          if ($page_root_len > 0) {$page_root_len += 1;} 
     212           
    209213          if (!empty($page_root)) 
    210214          { 
     
    214218               } 
    215219          }          
    216              
    217           if (is_readable($file->file)) 
    218           { 
    219                $_ctx->dlManager_item = $file; 
    220                $_ctx->file_url = $file->file_url; 
    221                 
    222                # compatibility with Dotclear revisions < 2445 
    223                global $attach_f; 
    224                $attach_f = new ArrayObject(); 
    225                $attach_f->file_url = $file->file_url; 
    226  
    227                $core->tpl->setPath($core->tpl->getPath(), 
    228                     dirname(__FILE__).'/default-templates/'); 
    229       
    230                self::serveDocument('media_player.html','text/html'); 
    231           } 
     220        
     221       $_ctx->dlManager_item->relname = 
     222               dirname(substr($_ctx->dlManager_item->relname,$page_root_len)); 
     223          if ($_ctx->dlManager_item->relname == '.') 
     224          { 
     225               $_ctx->dlManager_item->relname = ''; 
     226          } 
     227                
     228       # BreadCrumb 
     229          $breadCrumb = array(); 
     230 
     231          # if visitor asked a directory 
     232           
     233          $_ctx->dlManager_currentDir = $_ctx->dlManager_item->relname; 
     234          $page_dir = $page_root.'/'.$_ctx->dlManager_currentDir; 
     235 
     236          # BreadCrumb 
     237          $base_url = dlManager::pageURL().'/'; 
     238          $dirs = explode('/',$_ctx->dlManager_currentDir); 
     239          $path = ''; 
     240           
     241          foreach ($dirs as $dir) 
     242          { 
     243               $dir = trim($dir); 
     244                
     245               # check 
     246               if (($dir == '.') OR ($dir == '..')) {self::p404();} 
     247                
     248               if (!empty($dir)) 
     249               { 
     250                    $path = (($path == '') ? $dir : $path.'/'.$dir);  
     251                    $breadCrumb[$dir] = $base_url.$path; 
     252               } 
     253          } 
     254           
     255          $_ctx->dlManager_BreadCrumb = $breadCrumb; 
     256          unset($breadCrumb); 
     257          # /BreadCrumb 
     258           
     259          # compatibility with Dotclear revisions < 2445 
     260          global $attach_f; 
     261          $attach_f = new ArrayObject(); 
     262          $attach_f->file_url = $file->file_url; 
     263 
     264          $core->tpl->setPath($core->tpl->getPath(), 
     265               dirname(__FILE__).'/default-templates/'); 
     266 
     267          self::serveDocument('media_player.html','text/html'); 
    232268     } 
    233269      
     
    243279               self::p404(); 
    244280          } 
    245            
    246           if (!is_object($core->media)) 
    247           { 
    248                $core->media = new dcMedia($core); 
    249           } 
    250  
     281                
    251282          $file = $core->media->getFile($args); 
    252283           
     
    272303               $count[$file->media_id] = array_key_exists($file->media_id,$count) 
    273304                    ? $count[$file->media_id]+1 : 1; 
    274                if (!is_object($core->blog->settings)) 
    275                { 
    276                     $settings = new dcSettings($core,$core->blog->id); 
    277                } 
    278                else 
    279                { 
    280                     $settings =& $core->blog->settings; 
    281                } 
     305                
     306               $settings =& $core->blog->settings; 
     307                
    282308               $settings->setNamespace('dlmanager'); 
    283309               $settings->put('dlmanager_count_dl',serialize($count),'string', 
     
    934960               return; 
    935961          } 
    936  
    937           if (!is_object($core->media)) 
    938           { 
    939                $core->media = new dcMedia($core); 
    940           } 
    941  
     962                
    942963          # from /dotclear/admin/media.php 
    943964          if ($w->file_sort) { 
  • plugins/dlManager/default-templates/media.html

    r536 r537  
    5050 
    5151     <div id="dlmanager"> 
    52           <h3>{{tpl:lang Directories}}</h3> 
    53  
    5452          <p> 
    5553               <a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a> / 
    56                <!-- # loop on directory path, display full / 3 / 2 / 1 --> 
     54               <!-- # loop on directory path, display dir / subdir --> 
    5755               <tpl:DLMBreadCrumb> 
    5856                    <a href="{{tpl:DLMBreadCrumbDirURL}}"> 
     
    6260               </tpl:DLMBreadCrumb> 
    6361          </p> 
    64  
     62           
     63          <h3>{{tpl:lang Directories}}</h3> 
     64           
    6565          <tpl:DLMIfNoItem type="dirs"> 
    6666               <p>{{tpl:lang No directory.}}</p> 
  • plugins/dlManager/default-templates/media_player.html

    r536 r537  
    77  <meta name="MSSmartTagsPreventParsing" content="TRUE" /> 
    88  <meta name="robots" content="noindex, nofollow" /> 
    9   <title>{{tpl:lang Download manager}} - {{tpl:DLMItemTitle}} - {{tpl:BlogName encode_html="1"}}</title> 
     9  <title>{{tpl:lang Preview}} - {{tpl:DLMItemTitle}} - {{tpl:BlogName encode_html="1"}}</title> 
    1010   
    1111  <link rel="top" href="{{tpl:BlogURL}}" title="{{tpl:lang Home}}" /> 
     
    3838     <div id="content-info"> 
    3939          <h2> 
    40                {{tpl:lang Download manager}} 
     40               {{tpl:lang Preview}} 
    4141          </h2> 
    4242     </div> 
    43       
    44      <p><a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a></p> 
    45       
     43           
    4644     <tpl:DLMIfError> 
    4745          <div class="error"> 
     
    5149 
    5250     <div id="dlmanager"> 
    53           <h3>{{tpl:lang Preview :}} {{tpl:DLMItemTitle}}</h3> 
     51          <p> 
     52               <a href="{{tpl:DLMBaseURL}}">{{tpl:lang Home}}</a> / 
     53               <!-- # loop on directory path, display dir / subdir --> 
     54               <tpl:DLMBreadCrumb> 
     55                    <a href="{{tpl:DLMBreadCrumbDirURL}}"> 
     56                         {{tpl:DLMBreadCrumbDirName}}</a> 
     57                    <tpl:DLMBreadCrumbSeparator last="1"> /  
     58                         </tpl:DLMBreadCrumbSeparator> 
     59               </tpl:DLMBreadCrumb> 
     60               {{tpl:DLMItemBasename}} 
     61          </p> 
     62           
     63          <p><a href="{{tpl:DLMItemDirPath}}">{{tpl:lang Get back to the directory}}</a></p> 
     64           
    5465          <p> 
    5566               <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> 
     
    5869          </p> 
    5970           
     71          <div id="player"> 
    6072               <tpl:DLMItemIf media_type="image"> 
    61                     <img src="{{tpl:DLMItemImageThumbPath size="m"}}" alt="{{tpl:DLMItemTitle}}" /> 
     73                    <a href="{{tpl:DLMItemDlURL}}" title="{{tpl:DLMItemBasename}}"> 
     74                         <img src="{{tpl:DLMItemImageThumbPath size="m"}}" alt="{{tpl:DLMItemTitle}}" /> 
     75                    </a> 
    6276               </tpl:DLMItemIf> 
    63            
    64           <div id="player"> 
     77                
    6578               <tpl:DLMItemIf type="audio/mpeg3"> 
    6679                    {{tpl:include src="_mp3_player.html"}} 
  • plugins/dlManager/lib.dlManager.php

    r533 r537  
    3636          global $core; 
    3737 
     38          # empty default value 
    3839          $dirs = array(''=> ''); 
    39  
    40           $public_path = path::real($core->blog->public_path); 
    41           if (!is_dir($public_path)) {return(array());} 
    42  
    43           # +1 : remove slash at the beginning of the path when using substr() 
    44           $len_public_path = strlen($public_path)+1; 
    45  
    46           $dirList = files::getDirList($public_path); 
    47  
    48           foreach ($dirList['dirs'] as $dir) 
     40           
     41          try 
    4942          { 
    50                if ($dir != $public_path) 
     43               if (!is_object($core->media)) 
    5144               { 
    52                     $dir = substr($dir,$len_public_path); 
    53                     $dirs[$dir] = $dir; 
     45                    $core->media = new dcMedia($core); 
     46               } 
     47               # from gallery/gal.php 
     48               foreach ($core->media->getRootDirs() as $v) 
     49               { 
     50                    $dirs[$v->relname] = $v->relname; 
    5451               } 
    5552          } 
    56  
     53          catch (Exception $e) 
     54          { 
     55               $core->error->add($e->getMessage()); 
     56          } 
     57           
    5758          return($dirs); 
    5859     } 
  • plugins/dlManager/locales/fr/main.po

    r536 r537  
    33"Project-Id-Version: DL Manager\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2008-10-26 23:28+0100\n" 
    6 "PO-Revision-Date: 2008-10-26 23:28+0100\n" 
     5"POT-Creation-Date: 2008-10-27 17:29+0100\n" 
     6"PO-Revision-Date: 2008-10-27 17:29+0100\n" 
    77"Last-Translator: Moe <poedit@gniark.net>\n" 
    88"Language-Team: Moe <poedit@gniark.net>\n" 
     
    1717"X-Poedit-SearchPath-0: .\n" 
    1818 
    19 #: _public.php:155 
     19#: _public.php:154 
    2020#: public_l10n.php:7 
    2121msgid "parent directory" 
    2222msgstr "répertoire parent" 
    2323 
    24 #: _public.php:948 
    25 #: _public.php:954 
     24#: _public.php:982 
     25#: _public.php:989 
    2626msgid "Preview :" 
    2727msgstr "" 
    2828 
    29 #: _public.php:949 
    30 #: _public.php:955 
     29#: _public.php:984 
     30#: _public.php:991 
    3131msgid "Preview" 
    3232msgstr "" 
    3333 
    34 #: lib.dlManager.php:71 
     34#: lib.dlManager.php:72 
    3535msgid "By names, ascendant" 
    3636msgstr "Par noms, croissants" 
    3737 
    38 #: lib.dlManager.php:72 
     38#: lib.dlManager.php:73 
    3939msgid "By names, descendant" 
    4040msgstr "Par noms, décroissants" 
    4141 
    42 #: lib.dlManager.php:73 
     42#: lib.dlManager.php:74 
    4343msgid "By dates, ascendant" 
    4444msgstr "Par dates, croissantes" 
    4545 
    46 #: lib.dlManager.php:74 
     46#: lib.dlManager.php:75 
    4747msgid "By dates, descendant" 
    4848msgstr "Par dates, décroissantes" 
     
    214214 
    215215#: public_l10n.php:25 
     216msgid "Get back to the directory" 
     217msgstr "Revenir au répertoire" 
     218 
     219#: public_l10n.php:26 
    216220msgid "Download this file" 
    217221msgstr "Télécharger ce fichier" 
    218222 
     223#: public_l10n.php:27 
     224msgid "Image meta" 
     225msgstr "Méta données" 
     226 
  • plugins/dlManager/public_l10n.php

    r536 r537  
    2323 
    2424# media_item.html 
     25__('Get back to the directory'); 
    2526__('Download this file'); 
     27__('Image meta'); 
    2628?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map