Ticket #2923: mythweb.gallery.patch
File mythweb.gallery.patch, 47.9 KB (added by , 14 years ago) |
---|
-
skins/default/gallery.css
1 img { 2 border: 0px; 3 border-color: #000000; 4 } 5 6 table.current_path_and_viewsize { 7 margin-top:5px; 8 border:1px solid #626262; 9 padding:5px; 10 width:100%; 11 } 12 13 a { 14 color:#000000; 15 text-decoration:none; 16 } 17 18 a.header { 19 font-weight:bold; 20 font-style:italic; 21 } 22 23 a.folderlist { 24 font-style:italic; 25 } 26 27 td.current_path { 28 text-align:left; 29 width:auto; 30 } 31 32 td.change_viewsize_text { 33 text-align:right; 34 width:160px; 35 } 36 37 td.change_viewsize_selection { 38 text-align:right; 39 width:140px; 40 } 41 42 select.change_viewsize { 43 border:1px solid #323232; 44 background-color: #191c26; 45 color: #FFFFFF; 46 } 47 48 td.folder_navigation { 49 width:200px; 50 vertical-align:top; 51 } 52 53 table.folder_navigation { 54 margin-top:5px; 55 border:1px solid #626262; 56 padding:4px; 57 width:100%; 58 } 59 60 div.folder_navigation_active { 61 background-color: #224477; 62 border:1px solid #191c26; 63 text-align:left; 64 padding:4px; 65 } 66 67 div.folder_navigation { 68 border:1px solid #191c26; 69 text-align:left; 70 padding:4px; 71 } 72 73 td.image_listing { 74 width:auto; 75 vertical-align:top; 76 } 77 78 table.imagelist_and_navigation { 79 margin-top:5px; 80 margin-left:5px; 81 border:1px solid #626262; 82 padding:5px; 83 width:100%; 84 } 85 86 td.image_navigation { 87 text-align:center; 88 vertical-align:middle; 89 width:20%; 90 border-width: 0px; 91 } 92 93 td.single_image { 94 font-size:9pt; 95 padding:5px; 96 text-align:center; 97 } 98 99 img.single_image { 100 padding:7px; 101 border:1px solid #323232; 102 } 103 104 img.single_image_active { 105 background-color: #224477; 106 padding:7px; 107 border:1px solid #323232; 108 } 109 Kein Zeilenvorschub am Ende der Datei -
skins/grey/gallery.css
EigenschaftsÀnderungen: skins/default/gallery.css ___________________________________________________________________ Name: svn:executable + * Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/dir.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/last_page.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/prev_page_disabled.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/logo.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/next_page_disabled.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/first_page.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/last_page_disabled.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/prev_page.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/first_page_disabled.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/default/img/gallery/next_page.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream
1 img { 2 border: 0px; 3 border-color: #000000; 4 } 5 6 table.current_path_and_viewsize { 7 margin-top:5px; 8 border:1px solid #626262; 9 padding:5px; 10 width:100%; 11 } 12 13 a { 14 color:#000000; 15 text-decoration:none; 16 } 17 18 a.header { 19 font-weight:bold; 20 font-style:italic; 21 } 22 23 a.folderlist { 24 font-style:italic; 25 } 26 27 td.current_path { 28 text-align:left; 29 width:auto; 30 } 31 32 td.change_viewsize_text { 33 text-align:right; 34 width:160px; 35 } 36 37 td.change_viewsize_selection { 38 text-align:right; 39 width:140px; 40 } 41 42 select.change_viewsize { 43 border:1px solid #323232; 44 background-color: #212121; 45 } 46 47 td.folder_navigation { 48 width:200px; 49 vertical-align:top; 50 } 51 52 table.folder_navigation { 53 margin-top:5px; 54 border:1px solid #626262; 55 padding:4px; 56 width:100%; 57 } 58 59 div.folder_navigation_active { 60 background-color: #626262; 61 border:1px solid #212121; 62 text-align:left; 63 padding:4px; 64 } 65 66 div.folder_navigation { 67 border:1px solid #212121; 68 text-align:left; 69 padding:4px; 70 } 71 72 td.image_listing { 73 width:auto; 74 vertical-align:top; 75 } 76 77 table.imagelist_and_navigation { 78 margin-top:5px; 79 margin-left:5px; 80 border:1px solid #626262; 81 padding:5px; 82 width:100%; 83 } 84 85 td.image_navigation { 86 text-align:center; 87 vertical-align:middle; 88 width:20%; 89 border-width: 0px; 90 } 91 92 td.single_image { 93 font-size:9pt; 94 padding:5px; 95 text-align:center; 96 } 97 98 img.single_image { 99 padding:7px; 100 border:1px solid #323232; 101 } 102 103 img.single_image_active { 104 background-color: #626262; 105 padding:7px; 106 border:1px solid #323232; 107 } 108 Kein Zeilenvorschub am Ende der Datei -
skins/grey/img/gallery
EigenschaftsÀnderungen: skins/grey/gallery.css ___________________________________________________________________ Name: svn:executable + * Kann nicht anzeigen: Dateityp ist als binÀr angegeben. svn:mime-type = application/octet-stream EigenschaftsÀnderungen: skins/grey/img/gallery.png ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream
1 link /var/www/localhost/htdocs/mythweb/skins/default/img/gallery 2 Kein Zeilenvorschub am Ende der Datei -
modules/gallery/set_prefs.php
EigenschaftsÀnderungen: skins/grey/img/gallery ___________________________________________________________________ Name: svn:special + *
1 <?php 2 /** 3 * Weather settings 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/set_prefs.php $ 6 * @date $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $ 7 * @version $Revision: 12295 $ 8 * @author $Author: xris $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * @subpackage Weather 13 /**/ 14 15 // ======================================================= 16 // Load all of the known mythtv frontend hosts 17 $Settings_Hosts = array('' => t('MythWeb Session')); 18 $sh = $db->query('SELECT DISTINCT hostname FROM settings WHERE value="locale" ORDER BY hostname'); 19 20 // add all the found hosts into an array 21 while (list($host) = $sh->fetch_row()) 22 { 23 if (empty($host)) 24 continue; 25 $Settings_Hosts[$host] = $host; 26 } 27 $sh->finish(); 28 29 30 // Make sure we have a valid host selected 31 if (!isset( $Settings_Hosts[$_SESSION['settings']['host']]) ) 32 { 33 // we have no valid host, reset the array 34 $_SESSION['settings']['host'] = reset(array_keys($Settings_Hosts)); 35 } else { 36 // we have a valid host, check if the data should be saved 37 if ($_POST['save'] && isset($_POST['host'])) 38 { 39 // Changing settings for this MythWeb session 40 if (empty($_POST['host'])) 41 { 42 // save the image path in the session variable 43 $_SESSION['gallery']['image_path'] = $_POST['image_path']; 44 } else { 45 // save the settings in the database 46 $galleryConfig->setImagePath( $_POST['image_path'], $_POST['host'] ); 47 } 48 // Make sure the session host gets updated to the posted one. 49 $_SESSION['settings']['host'] = $_POST['host']; 50 } 51 } 52 53 54 // Display the gui for the settings 55 $galleryConfig = new GalleryConfig(); 56 57 58 class GalleryConfig 59 { 60 // variable that holds the configuration data from gallery.conf 61 var $config; 62 63 // ======================================================= 64 // constructor 65 function GalleryConfig() 66 { 67 $this->config = array(); 68 // the absolute path where the images are 69 $this->config['image_path'] = $this->getImagePath(); 70 // directory where the cached images are stored 71 // this directory is relative to the htdocs directory 72 $this->config['cache_path'] = '/mythweb/data/cache'; 73 // defines the default view mode 74 // default is 4 columns and 4 rows per page 75 $this->config['default_viewsize'] = '4,3'; 76 // width if the screen-200 (example 1024-200) 77 // this is needed to calculate the width of the images 78 $this->config['screen_width'] = '1024'; 79 // columns and rows that are shown on one page 80 // ; separates another mode 81 $this->config['viewsizes'] = '5,4 ; 4,4 ; 4,3 ; 3,3 ; 2,2 ; 1,1'; 82 // image extensions that will be shown, everything else 83 // will not work, currently there four are supported 84 $this->config['valid_image_files'] = 'jpg,png,gif,bmp'; 85 } 86 87 // ======================================================= 88 function getConfig() { 89 return $this->config; 90 } 91 92 // show the table with the configuration 93 function showConfig() 94 { 95 echo '<form class="form" method="post" action="'. form_action .'">'. 96 '<input type="hidden" name="host" value="'. html_entities($_SESSION['settings']['host']) .'"/>'. 97 '<table border="0" cellspacing="0" cellpadding="0">'. 98 '<tr class="_sep">'. 99 '<td>'. 100 t('Gallery image path').': '. 101 '</td>'. 102 '<td>'. 103 '<input type="text" name="image_path" value="'.$this->getImagePath().'">'. 104 '</td>'. 105 '</tr>'. 106 '<tr>'. 107 '<td align="center">'. 108 '<input type="reset" class="submit" value="'.t('Reset').'">'. 109 '</td>'. 110 '<td align="center">'. 111 '<input type="submit" class="submit" name="save" value="'.t('Save') .'">'. 112 '</td>'. 113 '</tr>'. 114 '</table>'. 115 '</form>'; 116 } 117 118 // get the image path from the database 119 function getImagePath() 120 { 121 global $db; 122 if (empty($_SESSION['settings']['host'])) { 123 $imagePath = _or($_SESSION['gallery']['image_path'], ''); 124 } else { 125 $imagePath = $db->query_col('SELECT data FROM settings 126 WHERE value="GalleryDir" 127 AND hostname=?', $_SESSION['settings']['host']); 128 } 129 return $imagePath; 130 } 131 132 // save the image path in the database 133 function setImagePath( $image_path, $host ) 134 { 135 $db->query('UPDATE settings SET data = ? 136 WHERE value="GalleryDir" AND hostname=?', $image_path, $host); 137 138 } 139 } 140 141 -
modules/gallery/handler.php
1 <?php 2 /** 3 * Handler for the Weather module. 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/handler.php $ 6 * @date $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $ 7 * @version $Revision: 12295 $ 8 * @author $Author: rsiebert $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * @subpackage MythGallery 13 * 14 /**/ 15 16 // Print the gallery page template 17 require_once tmpl_dir.'gallery.php'; 18 19 // Exit 20 exit; 21 -
modules/gallery/init.php
1 <?php 2 /** 3 * Initialization routines for the MythWeb Weather module 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/init.php $ 6 * @date $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $ 7 * @version $Revision: 12295 $ 8 * @author $Author: rsiebert $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * @subpackage Gallery 13 * 14 /**/ 15 16 // Settings options 17 $Settings['gallery'] = array('name' => t('Gallery'), 18 'choices' => array('prefs' => t('Preferences'), ), 19 'default' => 'prefs', 20 ); 21 22 // First, we should check to see that MythGallery is configured. 23 $has_gallery = $_SESSION['locale'] 24 ? true 25 : $db->query_col('SELECT COUNT(data) 26 FROM settings 27 WHERE value="locale"'); 28 29 30 31 // If gallery is enabled, add it to the list. 32 if ($has_gallery) { 33 $Modules['gallery'] = array('path' => 'gallery', 34 'sort' => 5, 35 'name' => t('Gallery'), 36 'description' => t('Local Image Gallery') 37 ); 38 } -
modules/gallery/tmpl/default/set_prefs.php
1 <?php 2 /** 3 * Display/save MythWeather settings 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/weather/tmpl/default/set_prefs.php $ 6 * @date $Date: 2007-01-09 07:37:34 +0100 (Di, 09 Jan 2007) $ 7 * @version $Revision: 12460 $ 8 * @author $Author: xris $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * @subpackage Weather 13 * 14 /**/ 15 16 // Display the gui for the settings 17 $galleryConfig->showConfig(); 18 19 ?> 20 Kein Zeilenvorschub am Ende der Datei -
modules/gallery/tmpl/default/welcome.php
1 <?php 2 /** 3 * Welcome page description of the Weather module. 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/welcome.php $ 6 * @date $Date: 2005-12-13 08:23:18 +0100 (Di, 13 Dez 2005) $ 7 * @version $Revision: 8252 $ 8 * @author $Author: xris $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * 13 /**/ 14 15 // Open with a div and an image 16 echo '<div id="info_gallery" class="hidden">', 17 '<img src="', skin_url, '/img/gallery.png" class="module_icon" />', 18 19 // Print a basic overview of what this module does 20 t('welcome: gallery'), 21 22 // Next, print a list of possible subsectons 23 #### 24 25 // Close the div 26 "</div>\n"; 27 Kein Zeilenvorschub am Ende der Datei -
modules/gallery/tmpl/default/gallery.php
1 <?php 2 /** 3 * Display template for the Weather module 4 * 5 * @url $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/gallery.php $ 6 * @date $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $ 7 * @version $Revision: 12295 $ 8 * @author $Author: xris $ 9 * @license GPL 10 * 11 * @package MythWeb 12 * 13 /**/ 14 15 // Page title 16 $page_title = 'MythWeb - '.t('Gallery'); 17 18 // Load this page's custom stylesheet 19 $headers[] = '<link rel="stylesheet" type="text/css" href="'.root.skin_dir.'/gallery.css" />'; 20 21 // Print the page header 22 require 'modules/_shared/tmpl/'.tmpl.'/header.php'; 23 require_once tmpl_dir.'gallery_config.php'; 24 25 // Print the gallery part 26 $gallery = new Gallery($data, $main); 27 $gallery->start(); 28 29 // Print the page footer 30 require 'modules/_shared/tmpl/'.tmpl.'/footer.php'; 31 32 class Gallery { 33 34 var $data; 35 var $main; 36 var $config; 37 38 function Gallery($data, $main) { 39 $this->data = $data; 40 $this->main = $main; 41 } 42 43 44 // ======================================================= 45 function start() { 46 // load default configuration 47 $galleryConfig = new GalleryConfig(); 48 $this->config = $galleryConfig->getConfig(); 49 // the current selected directory where the cached images are stored 50 $current_path = $this->getImagePath(); 51 // the path to the real images 52 $image_path = $this->config['image_path']; 53 // the filename of a selected image 54 $image_name = $this->getImageName(); 55 // the current viewsize mode 56 $image_viewsize = $this->getImageViewSize(); 57 // get the image index for the viewsize medium 58 $image_index = $this->getImageIndex(); 59 // get the contents of the folders 60 $folderList = $this->getFolderList( $current_path ); 61 // check what kind of images should be displayed 62 if ($image_viewsize == 'fullsize') { 63 // create the images if there are not yet in the directory 64 $this->makeImages( $current_path, $folderList, $image_viewsize, $image_index ); 65 // display the big image 66 $this->showFullsizeImage( $current_path, $folderList, $image_index ); 67 // there is nothing else to do 68 exit; 69 } 70 // show the horizontal navigation bar 71 $this->showGalleryHeader( $current_path, $image_viewsize, $image_index ); 72 // check if the thumbnail directory is there, if not create it 73 $this->makeDirectory( $current_path ); 74 // create the images if there are not yet in the directory 75 $this->makeImages( $current_path, $folderList, $image_viewsize, $image_index ); 76 echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n". 77 '<tr>'."\n". 78 '<td class="folder_navigation">'."\n"; 79 $this->showFolderTree( $current_path, $folderList ); 80 echo '</td>'."\n". 81 '<td class="image_listing">'."\n"; 82 if ($this->onlyDirectoriesAvailable( $current_path, $folderList, $image_viewsize, $image_index ) == false ) { 83 echo '<table class="imagelist_and_navigation" cellspacing="0" cellpadding="0">'."\n". 84 '<tr>'."\n". 85 '<td>'."\n"; 86 $this->showNavigation( $current_path, $folderList, $image_viewsize, $image_index ); 87 echo '</td>'."\n". 88 '</tr>'."\n". 89 '<tr>'."\n". 90 '<td>'."\n"; 91 $this->showImages( $current_path, $folderList, $image_viewsize, $image_index ); 92 echo '</td>'."\n". 93 '</tr>'."\n". 94 '</tr>'."\n". 95 '</table>'."\n"; 96 } else { 97 echo ' '; 98 } 99 echo '</td>'."\n". 100 '</tr>'."\n". 101 '</table>'."\n"; 102 } 103 104 // ======================================================= 105 function getViewSizesList() { 106 $viewsizesList = explode(';',preg_replace('/ /','',$this->config['viewsizes'])); 107 return $viewsizesList; 108 } 109 110 111 // ======================================================= 112 function getImagePath() { 113 switch ($_SERVER['REQUEST_METHOD']) { 114 case 'GET': 115 $current_path = stripslashes($_GET[path]); 116 break; 117 case 'POST': 118 $current_path = stripslashes($_POST[path]); 119 break; 120 } 121 if (!is_dir($current_path) ) { 122 $current_path = $this->config['image_path']; 123 } 124 return $current_path; 125 } 126 127 // ======================================================= 128 function getImageViewSize() { 129 switch ($_SERVER['REQUEST_METHOD']) { 130 case 'GET': 131 $viewsize = stripslashes($_GET[viewsize]); 132 break; 133 case 'POST': 134 $viewsize = stripslashes($_POST[viewsize]); 135 break; 136 } 137 // check if the given viewsize is one of the viewsizes 138 // specified in the config. fullsize is also needed 139 if (isset($viewsize) && 140 (($viewsize == 'fullsize') || 141 in_array($viewsize, $this->getViewSizesList()))) { 142 return $viewsize; 143 } else { 144 return $this->config['default_viewsize']; 145 } 146 } 147 148 // ======================================================= 149 function getImageName() { 150 switch ($_SERVER['REQUEST_METHOD']) { 151 case 'GET': 152 $image_name = $_GET['file']; 153 break; 154 case 'POST': 155 $image_name = $_POST['file']; 156 break; 157 } 158 return $image_name; 159 } 160 161 // ======================================================= 162 function getImageIndex() { 163 if (isset($_GET['index'])) 164 return $_GET['index']; 165 return 1; 166 } 167 168 169 // ======================================================= 170 // displays the path of the choosen directories horizontally 171 // so one can navigate back 172 function showGalleryHeader( $current_path, $image_viewsize, $image_index ) { 173 echo '<table class="current_path_and_viewsize" cellspacing="0" cellpadding="0">'."\n". 174 '<tr>'."\n". 175 '<td class="current_path">'. 176 t('Current path').': '; 177 $folders = explode('/', $current_path); 178 for ($i=1; $i < count($folders); $i++) { 179 echo '<a class="header" href="'.root.'gallery/gallery.php?'.path.'='; 180 // show thefolders in the navigation bar 181 for ($j=1; $j <= $i; $j++) { 182 echo '/'.$folders[$j]; 183 } 184 echo '&'.viewsize.'='.$this->getImageViewSize().'">'. 185 $folders[$i].'</a>'."\n"; 186 // don't show the separators when there are no more subfolders 187 if ($i < (count($folders)-1)) { 188 echo ' / '; 189 } 190 } 191 // display the menu where one can shoose between small and medium images 192 echo '</td>'."\n". 193 '<td class="change_viewsize_text">'. 194 t('Switch view mode').': '. 195 '</td>'."\n". 196 '<form name="change_viewsize" method="post">'."\n". 197 '<td class="change_viewsize_selection">'."\n". 198 '<select class="change_viewsize" name="'. 199 viewsize.'" onChange="submit()" size="1">'."\n"; 200 $viewsizesList = $this->getViewSizesList(); 201 for ($i=0; $i < count($viewsizesList); $i++) { 202 echo '<option value="'.$viewsizesList[$i].'" '; 203 if ($this->getImageViewSize() == $viewsizesList[$i]) { 204 echo 'selected'; 205 } 206 $str = strtr($viewsizesList[$i], ',','x'); 207 echo '>'.$str.' '.t('Images per page').'</option>'."\n"; 208 } 209 echo '</select>'."\n". 210 '<input type="hidden" name="'.index.'" value="'.$image_index.'">'. 211 '<input type="hidden" name="'.path.'" value="'.$current_path.'">'; 212 echo '</td></form>'."\n". 213 '</tr>'."\n". 214 '</table>'."\n"; 215 } 216 217 // ======================================================= 218 function showFolderTree( $current_path, $folderList ) { 219 220 // dont go into the directory if there are not subdirs 221 if ($this->getFolderCount( $current_path, $folderList[$i]) == 0) { 222 $current_path = substr($current_path, 0, strrpos($current_path, '/')); 223 $folderList = $this->getFolderList( $current_path ); 224 } 225 // displays the directory tree and the pictures 226 echo '<table class="folder_navigation" width="100%" cellspacing="0" cellpadding="0">'."\n". 227 '<tr>'."\n". 228 '<td>'."\n"; 229 // display the directories 230 for ($i = 0; $i < count( $folderList ); $i++) { 231 // only display folders that are not hidden or special 232 if ((is_dir( $current_path.'/'.$folderList[$i] )) && 233 ($folderList[$i] != '..')){ 234 echo '<div class="folder_navigation" '. 235 'onmouseover="this.className=\'folder_navigation_active\'" '. 236 'onmouseout="this.className=\'folder_navigation\'">'; 237 $link = $this->getFolderLink( $current_path, $folderList[$i] ); 238 $folderCount = $this->getFolderCount( $current_path, $folderList[$i] ); 239 // display the folder as a link and the number of subfolder next to it 240 $this->displayFolderLink( $link, $folderList[$i], $folderCount ); 241 echo '</div>'; 242 } 243 } 244 echo '</td>'."\n". 245 '</tr>'."\n". 246 '</table>'."\n"; 247 } 248 249 // ======================================================= 250 function getFolderList( $current_path ) { 251 if ($current_path != $this->config['cache_path'] ) { 252 $folderList[] = '..'; 253 } 254 // get the image extensions 255 $extenstionList = explode(',',$this->config['valid_image_files']); 256 // get the directories and files 257 if ($dh = opendir($current_path)) { 258 while (($file = readdir($dh)) !== false) { 259 // only add the file/dir if its a directory or a file 260 // with the specified extension 261 if ((substr($file,0,1) != '.') && 262 (is_dir($current_path.'/'.$file)) || 263 (in_array(strtolower(substr($file,-3)), $extenstionList))) 264 { 265 $folderList[] = $file; 266 } 267 } 268 } 269 // delete the first entry when we are at the image_path 270 // to prevent from going a directory up 271 if ($current_path == $this->config['image_path']) 272 array_shift($folderList); 273 // sort the array alphabetically 274 sort($folderList); 275 return $folderList; 276 } 277 278 // ======================================================= 279 function getFolderLink( $current_path, $folder ) { 280 $link = '<a class="folderlist" href="'.root.'gallery/gallery.php?'.path.'='; 281 // display the .. directory only if there is another 282 // directory above this one. 283 if (($folder == '..') && ($current_path != $this->config['cache_path'])) { 284 $folderList = explode( '/', $current_path.'/'); 285 for( $i=1; $i < count($folderList)-2; $i++ ) { 286 $link .= '/'.$folderList[$i]; 287 } 288 } else { 289 $link .= $current_path.'/'.$folder; 290 } 291 $link .= '&'.viewsize.'='.$this->getImageViewSize().'">'; 292 return $link; 293 } 294 295 // ======================================================= 296 function displayFolderLink( $link, $folder, $folderCount ) { 297 echo '<table class="folderlink_inactive" cellspacing="0" cellpadding="0">'. 298 '<tr>'. 299 '<td align="left" width="30px">'. 300 '<img class="navigation" src="'.root.skin_dir.'/img/gallery/dir.png">'. 301 '</td>'. 302 '<td align="left" width="auto">'. 303 $link.$folder.'</a>'; 304 $this->displayFolderCount( $folderCount ); 305 echo '</td>'. 306 '</tr>'. 307 '</table>'."\n"; 308 } 309 310 // ======================================================= 311 function getFolderCount($current_path, $folder) { 312 // dont get the folder count if its the .. directory 313 if ($folder != '..') { 314 return count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR)); 315 } 316 } 317 318 // ======================================================= 319 // shows how many sub directories the specified folder has 320 function displayFolderCount( $folderCount ) { 321 if ($folderCount == 1) { 322 echo ' ('.$folderCount.')';// '.t('subfolder'); 323 } 324 if ($folderCount > 1) { 325 echo ' ('.$folderCount.')';// '.t('subfolders'); 326 } 327 } 328 329 330 // ======================================================= 331 // creates the directory for the thumbnails. the directory 332 // structure is identical to the one of original pictures 333 function makeDirectory( $current_path ) { 334 if (!file_exists( $this->config['cache_path'].$current_path )) { 335 // add the document root to the thumbnail directory 336 // because mkdir works with absolute paths 337 $cache_path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path']; 338 // split the directory string into separate directories 339 $folderList = explode( '/', $current_path ); 340 // go through all folder and create each one 341 for($i=1; $i < count($folderList); $i++) { 342 $cache_path .= '/'.$folderList[$i]; 343 // check if the directory is already there 344 if (!file_exists($cache_path)) { 345 mkdir ($cache_path); 346 } 347 } 348 } 349 } 350 351 // ======================================================= 352 // check if the images are there, if not create them 353 function makeImages( $current_path, $folderList, $image_viewsize, $image_index ) { 354 $path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path; 355 // use the image_viewsize numbers as a prefix if fullsize is not requested 356 if ( $image_viewsize != fullsize ) { 357 // only so many images will be created that will be displayed on the screen 358 $max_cols = substr($image_viewsize, 0, 1); 359 $max_rows = substr($image_viewsize, 2, 1); 360 $max_number = ($max_cols * $max_rows); 361 // the prefix that will be added to a file so that 362 // different sizes have different names 363 $file_prefix = strtr($image_viewsize, ',','_').'_'; 364 } else { 365 $max_number = 1; 366 // the prefix that will be added to a file so that 367 // different sizes have different names 368 $file_prefix = $image_viewsize.'_'; 369 } 370 // get the amount of subfolders. increase the count in the loop by these 371 // subfolders 372 $folder_count = count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR)); 373 for ($i = $image_index; $i < ($max_number + $image_index + $folder_count); $i++) { 374 // show the picture only if its not hidden and not a directory 375 if (!is_dir( $current_path.'/'.$folderList[$i] )) { 376 // check if there is already a thumbnail available, if not create it 377 if (!file_exists( $path.'/'.$file_prefix.$folderList[$i] )) { 378 // get the extension of the file 379 $fileParts = explode('.', $folderList[$i]); 380 $file_extension = strtolower($fileParts[count($fileParts)-1]); 381 // get image pointer 382 $image_p = null; 383 if ($file_extension == 'jpg') 384 $image_p = @imagecreatefromjpeg( $current_path.'/'.$folderList[$i] ); 385 if ($file_extension == 'png') 386 $image_p = @imagecreatefrompng( $current_path.'/'.$folderList[$i] ); 387 if ($file_extension == 'gif') 388 $image_p = @imagecreatefromgif( $current_path.'/'.$folderList[$i] ); 389 // proceed if we have an image pointer 390 if ($image_p) { 391 // get the image size for the cached images 392 $size = getimagesize( $current_path.'/'.$folderList[$i]); 393 $width = $size[0]; 394 $height = $size[1]; 395 // get the width for the choosen viewsize 396 // calculate it from the columns and rows if fullsize is not 397 // requested, otherwise use the original image size 398 if ( $image_viewsize != fullsize ) { 399 $new_width = (( $this->config['screen_width'] / $max_cols ) - 50 ); 400 // calculate new image dimensions 401 $new_height = ($height/$width) * $new_width; 402 if ( $height > $width ) { 403 $new_width = ($width/$height) * $new_height; 404 } 405 } else { 406 $new_width = $width; 407 $new_height = $height; 408 } 409 // get a new image pointer 410 $new_image_p = imagecreatetruecolor($new_width, $new_height); 411 // resample the old image to the new one 412 imagecopyresampled($new_image_p, $image_p, 0, 0, 0, 0, 413 $new_width, $new_height, $width, $height ); 414 // save the image 415 if ($file_extension == 'jpg') 416 imagejpeg($new_image_p, $path.'/'.$file_prefix.$folderList[$i] ); 417 if ($file_extension == 'png') 418 imagepng($new_image_p, $path.'/'.$file_prefix.$folderList[$i] ); 419 if ($file_extension == 'gif') 420 imagegif($new_image_p, $path.'/'.$file_prefix.$folderList[$i] ); 421 // destroy the old pointers 422 imagedestroy( $image_p ); 423 imagedestroy( $new_image_p ); 424 } 425 } 426 } 427 } 428 } 429 430 // ======================================================= 431 function showImages( $current_path, $folderList, $image_viewsize, $image_index ) { 432 433 $path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path; 434 // get the column and row values, display that many images in a row 435 $max_cols = substr($image_viewsize, 0, 1); 436 $max_rows = substr($image_viewsize, 2, 1); 437 // counter for the current column and row 438 $current_col = 0; 439 // the prefix that will be added to a file so that different sizes have different names 440 $file_prefix = strtr($image_viewsize, ',','_').'_'; 441 442 // get the amount of subfolders 443 $folder_count = count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR)); 444 // increase the index by the folder count 445 for ($i = 1; $i <= $folder_count; $i++) { 446 $image_index += 1; 447 } 448 echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n". 449 '<tr>'. 450 '<td colspan="'.$max_cols.'">'. 451 ' '. 452 '</td>'. 453 '</tr>'; 454 // go through all entries in the folderList 455 for ($i = $image_index; $i < (($max_cols * $max_rows)+$image_index); $i++) { 456 if (( file_exists( $path.'/'.$file_prefix.$folderList[$i] )) && 457 ( isset($folderList[$i]) )) { 458 // if the column is zero then start a new row 459 // the specified number of images will be displayed side by side 460 if ( $current_col == 0 ) echo '<tr>'."\n"; 461 // stretch the table cells to equal size 462 echo '<td class="single_image" style="width:'; 463 // calculate the width of the cells 464 echo floor( 100 / $max_cols ); 465 echo '%;">'."\n". 466 // display the image centered and put border around it 467 '<div align="center">'."\n". 468 '<a href="'.root.'gallery/gallery.php?'. 469 path.'='.$current_path. 470 '&'.index.'='.$i. 471 '&'.viewsize.'='.fullsize. 472 '" target="blank">'."\n". 473 '<img class="single_image" src="'. 474 $this->config['cache_path'].$current_path.'/'. 475 $file_prefix.$folderList[$i].'" '. 476 'onmouseover="this.className=\'single_image_active\'" '. 477 'onmouseout="this.className=\'single_image\'">'."\n". 478 '</a>'."\n". 479 '</div>'."\n". 480 '<div align="center">'."\n". 481 // show the filename 482 $folderList[$i]."\n". 483 '</div>'."\n". 484 '</td>'."\n"; 485 // if the max number of columns are reached close the row 486 if ( $current_col == $max_cols ) echo '</tr>'."\n"; 487 // reset the column count back to zero 488 $current_col++; 489 if ( $current_col == $max_cols ) $current_col = 0; 490 } 491 } 492 echo '</table>'; 493 } 494 495 496 // ======================================================= 497 function onlyDirectoriesAvailable( $current_path, $folderList, $image_viewsize, $image_index ) { 498 $path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path; 499 // only so many images will be created that will be displayed on the screen 500 $max_cols = substr($image_viewsize, 0, 1); 501 $max_rows = substr($image_viewsize, 2, 1); 502 $max_number = ($max_cols * $max_rows); 503 // the prefix that will be added to a file so that different sizes have different names 504 $file_prefix = strtr($image_viewsize, ',','_').'_'; 505 506 // go through the folderList. if there are only directories in it 507 // then dont display the navigation stuff 508 $only_dirs = true; 509 for ($i = 0; $i < count($folderList); $i++) { 510 if ( file_exists( $path.'/'.$file_prefix.$folderList[$i] )) { 511 $only_dirs = false; 512 break; 513 } 514 } 515 return $only_dirs; 516 } 517 518 // ======================================================= 519 function showNavigation( $current_path, $folderList, $image_viewsize, $image_index ) { 520 $path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path; 521 // only so many images will be created that will be displayed on the screen 522 $max_cols = substr($image_viewsize, 0, 1); 523 $max_rows = substr($image_viewsize, 2, 1); 524 $max_number = ($max_cols * $max_rows); 525 // the prefix that will be added to a file so that different sizes have different names 526 $file_prefix = strtr($image_viewsize, ',','_').'_'; 527 528 echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n". 529 '<tr>'."\n". 530 '<td class="image_navigation"> '."\n". 531 '</td>'."\n". 532 '<td class="image_navigation">'."\n"; 533 // display the goto first page link 534 if ($image_index != 1) { 535 echo '<a href="'.root.'gallery/gallery.php?'. 536 '&'.path.'='.$current_path. 537 '&'.index.'=1'. 538 '&'.viewsize.'='.$image_viewsize.'">'."\n". 539 // display the right arrow 540 '<img src="'.root.skin_dir.'/img/gallery/first_page.png">'. 541 '</a>'."\n"; 542 } else { 543 echo '<img src="'.root.skin_dir.'/img/gallery/first_page_disabled.png">'."\n"; 544 } 545 // display the previous page icon if there are more than one entries 546 if ($image_index != 1) { 547 echo '<a href="'.root.'gallery/gallery.php?'. 548 '&'.path.'='.$current_path. 549 '&'.index.'='; 550 if ($image_index < $max_number) { 551 echo 1; 552 } else { 553 echo ($image_index - $max_number); 554 } 555 echo '&'.viewsize.'='.$image_viewsize.'">'."\n". 556 // display the left arrow 557 '<img src="'.root.skin_dir.'/img/gallery/prev_page.png">'. 558 '</a>'."\n"; 559 } else { 560 echo '<img src="'.root.skin_dir.'/img/gallery/prev_page_disabled.png">'."\n"; 561 } 562 echo '</td>'."\n". 563 '<td class="image_navigation">'."\n". 564 // display an info in what page we are right now 565 '( '.$image_index.' '.t('to').' '; 566 if (($image_index + $max_number) < count($folderList)) { 567 echo ($image_index+$max_number-1); 568 } else { 569 echo (count($folderList)-1); 570 } 571 echo ' '.t('of').' '.(count($folderList)-1).' )'."\n". 572 '</td>'."\n". 573 '<td class="image_navigation">'."\n"; 574 // display the next page link 575 if (($image_index + $max_number) < count($folderList)) { 576 echo '<a href="'.root.'gallery/gallery.php?'. 577 '&'.path.'='.$current_path. 578 '&'.index.'='.($image_index + $max_number). 579 '&'.viewsize.'='.$image_viewsize.'">'."\n". 580 // display the right arrow 581 '<img src="'.root.skin_dir.'/img/gallery/next_page.png">'. 582 '</a>'."\n"; 583 } else { 584 echo '<img src="'.root.skin_dir.'/img/gallery/next_page_disabled.png">'."\n"; 585 } 586 // display the goto last page link 587 if (($image_index + $max_number) < count($folderList)) { 588 echo '<a href="'.root.'gallery/gallery.php?'. 589 '&'.path.'='.$current_path. 590 '&'.index.'='. 591 (count($folderList) - (count($folderList) % $max_number)+1). 592 '&'.viewsize.'='.$image_viewsize.'">'."\n". 593 // display the right arrow 594 '<img src="'.root.skin_dir.'/img/gallery/last_page.png">'. 595 '</a>'."\n"; 596 } else { 597 echo '<img src="'.root.skin_dir.'/img/gallery/last_page_disabled.png">'."\n"; 598 } 599 echo '</td>'."\n". 600 '<td class="image_navigation"> '."\n". 601 '</td>'."\n". 602 '</tr>'."\n". 603 '</table>'."\n"; 604 } 605 606 // ======================================================= 607 function showFullsizeImage( $current_path, $folderList, $image_index ) { 608 echo '<html>'."\n". 609 '<head>'."\n". 610 '<title>'.$folderList[$image_index].'</title>'."\n". 611 '</head>'."\n". 612 '<body>'."\n". 613 '<div>'."\n". 614 '<img src="'."\n". 615 $this->config['cache_path'].$current_path.'/'. 616 fullsize.'_'.$folderList[$image_index].'">'."\n". 617 '</div>'."\n". 618 '</body>'."\n". 619 '</html>'; 620 } 621 622 // ======================================================= 623 } -
modules/gallery/tmpl/default/gallery_config.php
1 <?php 2 3 class GalleryConfig { 4 // variable that holds the configuration data from gallery.conf 5 var $config; 6 // ======================================================= 7 // constructor 8 function GalleryConfig() 9 { 10 $this->config = array(); 11 // the absolute path where the images are 12 $this->config['image_path'] = $this->getImagePath(); 13 // directory where the cached images are stored 14 // this directory is relative to the htdocs directory 15 $this->config['cache_path'] = '/mythweb/data/cache'; 16 // defines the default view mode 17 // default is 4 columns and 4 rows per page 18 $this->config['default_viewsize'] = '4,3'; 19 // width if the screen-200 (example 1024-200) 20 // this is needed to calculate the width of the images 21 $this->config['screen_width'] = '1024'; 22 // columns and rows that are shown on one page 23 // ; separates another mode 24 $this->config['viewsizes'] = '5,4 ; 4,4 ; 4,3 ; 3,3 ; 2,2 ; 1,1'; 25 // image extensions that will be shown, everything else 26 // will not work, currently there four are supported 27 $this->config['valid_image_files'] = 'jpg,png,gif,bmp'; 28 } 29 30 // ======================================================= 31 function getConfig() { 32 return $this->config; 33 } 34 35 // show the table with the configuration 36 function showConfig() 37 { 38 echo '<form class="form" method="post" action="'. form_action .'">'. 39 '<input type="hidden" name="host" value="'. html_entities($_SESSION['settings']['host']) .'"/>'. 40 '<table border="0" cellspacing="0" cellpadding="0">'. 41 '<tr class="_sep">'. 42 '<td>'. 43 t('Gallery image path').': '. 44 '</td>'. 45 '<td>'. 46 '<input type="text" name="image_path" value="'.getImagePath().'">'. 47 '</td>'. 48 '</tr>'. 49 '<tr>'. 50 '<td align="center">'. 51 '<input type="reset" class="submit" value="'.t('Reset').'">'. 52 '</td>'. 53 '<td align="center">'. 54 '<input type="submit" class="submit" name="save" value="'.t('Save') .'">'. 55 '</td>'. 56 '</tr>'. 57 '</table>'. 58 '</form>'; 59 } 60 61 62 // get the image path from the database 63 function getImagePath() 64 { 65 global $db; 66 if (empty($_SESSION['settings']['host'])) { 67 $imagePath = _or($_SESSION['gallery']['image_path'], ''); 68 } else { 69 $imagePath = $db->query_col('SELECT data FROM settings 70 WHERE value="GalleryDir" 71 AND hostname=?', $_SESSION['settings']['host']); 72 } 73 return $imagePath; 74 } 75 76 } 77 78 ?> 79 Kein Zeilenvorschub am Ende der Datei -
modules/_shared/lang/German.lang
EigenschaftsÀnderungen: modules/gallery/tmpl/default/gallery_config.php ___________________________________________________________________ Name: svn:executable + *
196 196 "Create a Random Mix" 197 197 "Create Schedule" 198 198 Speichern 199 "Current path" 200 Aktueller Pfad 199 201 "Current Conditions" 200 202 Das aktuelle Wetter 201 203 "Current recordings" … … 311 313 Kanal 312 314 "Friday" 313 315 Freitag 316 "Gallery" 317 Gallerie 318 "Gallery image path" 319 Pfad der Bilder 314 320 "Generic Episodes" 321 generische Episoden 315 322 "generic_date" 316 323 %e.%m.%Y 317 324 "generic_time" … … 355 362 Farbton 356 363 "Humidity" 357 364 Luftfeuchtigkeit 365 "Images per page" 366 Bilder pro Seite 358 367 "IMDB" 359 368 IMDB 360 369 "imdb rating" … … 381 390 "Keybindings Editor" 382 391 Tastenbelegung bearbeiten 383 392 "Keyword" 384 Schlsselwort 393 Schlsselwort 385 394 "Keyword Search" 386 395 Suche nach SchlÃŒsselwort 387 396 "Keywords" … … 495 504 "Number of shows" 496 505 "Number of Songs" 497 506 "Number of timeslots" 507 "of" 508 von 498 509 "Only display favourite channels" 499 510 Nur Favoriten anzeigen 500 511 "Only match commercial-free channels" … … 795 806 "Streaming Quality" 796 807 "Sub and Desc (Empty matches)" 797 808 Untertitel & Beschr. (kein Ergebnis) 809 "subfolder" 810 Unterordner 811 "subfolders" 812 Unterordner 798 813 "Submit Search" 799 814 "Subtitle" 800 815 Untertitel … … 804 819 mit Untertitel 805 820 "Sunday" 806 821 Sonntag 822 "Switch view mode" 823 Ansichtsmodus wechseln 807 824 "The requested recording schedule has been deleted." 808 825 Die geplante Aufnahme wurde gelöscht. 809 826 "There are no items in this Playlist!" … … 824 841 Titel 825 842 "Title Search" 826 843 Titel Suche 844 "to" 845 bis 827 846 "Today" 828 847 Heute 829 848 "Tomorrow" … … 914 933 Mittwoch 915 934 "welcome: backend_log" 916 935 Backend Log 936 "welcome: gallery" 937 Gallerie 917 938 "welcome: music" 918 939 Musik 919 940 "welcome: settings" -
modules/_shared/lang/English.lang
133 133 "Create Schedule" 134 134 "Current Conditions" 135 135 "Current recordings" 136 "Current path" 136 137 "Currently Browsing: $1" 137 138 "Custom" 138 139 "Custom Schedule" … … 228 229 "Hour Format" 229 230 "hue" 230 231 "Humidity" 232 "Images per page" 231 233 "IMDB" 232 234 "imdb rating" 233 235 "Inactive" … … 331 333 "Number of shows" 332 334 "Number of Songs" 333 335 "Number of timeslots" 336 "of" 334 337 "Only display favourite channels" 335 338 "Only match commercial-free channels" 336 339 "Only match HD programs" … … 573 576 "Subtitle and Description" 574 577 "Subtitled" 575 578 "Sunday" 579 "Switch view mode" 576 580 "The requested recording schedule has been deleted." 577 581 "There are no items in this Playlist!" 578 582 "There was a problem saving your playlist" … … 586 590 "title" 587 591 "Title" 588 592 "Title Search" 593 "to" 589 594 "Today" 590 595 "Tomorrow" 591 596 "Too Many" … … 641 646 "Wednesday" 642 647 "welcome: backend_log" 643 648 Show the server logs. 649 "welcome: gallery" 650 Browse your picture collection. 644 651 "welcome: music" 645 652 Browse your music collection. 646 653 "welcome: settings" -
modules/_shared/tmpl/default/header.php
81 81 </a> 82 82 <?php 83 83 } 84 if ($Modules['gallery']) { 84 85 ?> 86 <a id="gallery_link"<?php if ($Path[0] == 'gallery') echo ' class="current_section"' ?> href="<?php echo root ?>gallery" onmouseover="return help_text('<?php echo str_replace("'", "\\'", t('MythWeb Gallery.')) ?>')" onmouseout="return help_text()"> 87 <img src="<?php echo skin_url ?>img/gallery.png" width="48" height="48" class="alpha_png" alt="MythGallery" /> 88 </a> 89 <?php 90 } 91 ?> 85 92 <a id="settings_link"<?php if ($Path[0] == 'settings') echo ' class="current_section"' ?> href="<?php echo root ?>settings" onmouseover="return help_text('<?php echo str_replace("'", "\\'", t('Edit MythWeb and some MythTV settings.')) ?>')" onmouseout="return help_text()"> 86 93 <img src="<?php echo skin_url ?>img/settings.png" width="48" height="48" class="alpha_png" alt="<?php echo t('Settings') ?>" /> 87 94 </a>