DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:directorylist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:directorylist [2014-01-23 09:38] – added similar plugin alexwenzelplugin:directorylist [2024-01-22 16:17] (current) Aleksandr
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: +description: Specify a directory and this plugin will list all contained items and make them downloadable.
 author     : alexwenzel  author     : alexwenzel 
 email      : alexander.wenzel.berlin@gmail.com  email      : alexander.wenzel.berlin@gmail.com 
 type       : Syntax, Action type       : Syntax, Action
-lastupdate : 2014-01-21+lastupdate : 2017-10-03
 compatible : Binky, 2013-12-08 compatible : Binky, 2013-12-08
 depends    :  depends    : 
Line 15: Line 15:
 downloadurl: https://github.com/alexwenzel/dokuwiki-plugin-directorylist/archive/master.zip downloadurl: https://github.com/alexwenzel/dokuwiki-plugin-directorylist/archive/master.zip
 bugtracker : https://github.com/alexwenzel/dokuwiki-plugin-directorylist/issues bugtracker : https://github.com/alexwenzel/dokuwiki-plugin-directorylist/issues
-sourcerepo : https://github.com/alexwenzel/dokuwiki-plugin-directorylist/tree/master+sourcerepo : https://github.com/alexwenzel/dokuwiki-plugin-directorylist/
 donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YP4LDRJFB9F94 donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YP4LDRJFB9F94
  
-screenshot_img : https://raw2.github.com/alexwenzel/dokuwiki-plugin-directorylist/development/example1.png+screenshot_img : https://raw.githubusercontent.com/alexwenzel/dokuwiki-plugin-directorylist/development/example1.png
 ---- ----
  
-====== About ======+===== About =====
  
 Specify a directory and this plugin will list all contained items and made them downloadable. Specify a directory and this plugin will list all contained items and made them downloadable.
  
 This is mostly used for intranets. This is mostly used for intranets.
- 
-**Information:** This is still under development and not finished or secured. 
  
 Contact me if anything. Contact me if anything.
  
-====== Installation & usage ======+===== Installation & Usage ===== 
 + 
 +Please visit the github page for **detailed** information! 
 + 
 +[[https://github.com/alexwenzel/dokuwiki-plugin-directorylist]] 
 + 
 +===== Discussion ===== 
 + 
 +The plugin currently only supports the 'download' hyperref option, which means that all links result in a downloaded file. 
 + 
 +By adding a new argument, 'type', and slightly altering the formatLink() function we can support direct links. 
 + 
 +I've done a slight hack to get the correct url path. 
 + 
 +Below is the diff output for my changes on the directorylist/syntax/directorylist.php file. 
 + 
 +<code diff> 
 +107,110d106 
 +<                       // check and set default: type argument 
 +<                       if ( ! isset($data['type']) || empty($data['type']) )  
 +<                               $data['type'] = 'link'; 
 +<  
 +161c157 
 +<                                       $this->renderer->doc .= '<li class="file">'.$this->formatLink($value,$data).$this->formatBytes($value).'</li>'; 
 +--- 
 +>                                       $this->renderer->doc .= '<li class="file">'.$this->formatLink($value).$this->formatBytes($value).'</li>'; 
 +210,212d205 
 +<  
 +<  
 +<  
 +218c211 
 +<       private function formatLink(SplFileInfo $file, array $data) 
 +--- 
 +>       private function formatLink(SplFileInfo $file) 
 +220,238c213,214 
 +<               global $conf; 
 +<  
 +<               $link  = '<a href="'; 
 +<               if( $data['type']=='download' ) { 
 +<                   $link .= '?do=download&file='.rawurlencode($file->getRealPath()); 
 +<               } else if( $data['type']=='direct' ) { 
 +<                   $link .= 'file://'.$file->getRealPath(); 
 +<               } else if ($data['type']=='link'){ 
 +<                   $startpos = strpos( $file->getRealPath(), $conf['basedir'] ); 
 +<                   $link .= $conf['baseurl'].substr( $file->getRealPath(), $startpos); 
 +<               } else { 
 +<                   $link .= ''; 
 +<               } 
 +<               $link .= '"'; 
 +<               if( $data['type']=='download' ) { 
 +<                   $link .= ' target="_blank"'; 
 +<               } 
 +<               $link .= ' title="'.$file->getFilename().'"'; 
 +<               $link .= '>'; 
 +--- 
 +>               $link = '<a href="?do=download&file='.rawurlencode($file->getRealPath()).'" target="_blank" '; 
 +>               $link .= 'title="'.$file->getFilename().'">'; 
 + 
 +</code>
  
-Please visit the github page for __detailed__ information!+ --- [[user>simon.w|simon.w]] //2015-06-02 16:27//
  
-https://github.com/alexwenzel/dokuwiki-plugin-directorylist+Hi, I have accepted your pull requestThank you
  
 +//alexwenzel//
plugin/directorylist.1390466301.txt.gz · Last modified: 2014-01-23 09:38 by alexwenzel

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki