[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: mod_templatechooser.php 1494 2005-12-20 16:07:35Z Jinx $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 6 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 16 17 global $cur_template; 18 19 // titlelength can be set in module params 20 $titlelength = $params->get( 'title_length', 20 ); 21 $preview_height = $params->get( 'preview_height', 90 ); 22 $preview_width = $params->get( 'preview_width', 140 ); 23 $show_preview = $params->get( 'show_preview', 0 ); 24 25 // Read files from template directory 26 $template_path = "$mosConfig_absolute_path/templates"; 27 $templatefolder = @dir( $template_path ); 28 $darray = array(); 29 30 if ($templatefolder) { 31 while ($templatefile = $templatefolder->read()) { 32 if ($templatefile != "." && $templatefile != ".." && $templatefile != ".svn" && $templatefile != "css" && is_dir( "$template_path/$templatefile" ) ) { 33 if(strlen($templatefile) > $titlelength) { 34 $templatename = substr( $templatefile, 0, $titlelength-3 ); 35 $templatename .= "..."; 36 } else { 37 $templatename = $templatefile; 38 } 39 $darray[] = mosHTML::makeOption( $templatefile, $templatename ); 40 } 41 } 42 $templatefolder->close(); 43 } 44 45 sort( $darray ); 46 47 // Show the preview image 48 // Set up JavaScript for instant preview 49 $onchange = ""; 50 if ($show_preview) { 51 $onchange = "showimage()"; 52 ?> 53 <img src="<?php echo "templates/$cur_template/template_thumbnail.png";?>" name="preview" border="1" width="<?php echo $preview_width;?>" height="<?php echo $preview_height;?>" alt="<?php echo $cur_template; ?>" /> 54 <script language='JavaScript1.2' type='text/javascript'> 55 <!-- 56 function showimage() { 57 //if (!document.images) return; 58 document.images.preview.src = 'templates/' + getSelectedValue( 'templateform', 'jos_change_template' ) + '/template_thumbnail.png'; 59 } 60 function getSelectedValue( frmName, srcListName ) { 61 var form = eval( 'document.' + frmName ); 62 var srcList = eval( 'form.' + srcListName ); 63 64 i = srcList.selectedIndex; 65 if (i != null && i > -1) { 66 return srcList.options[i].value; 67 } else { 68 return null; 69 } 70 } 71 --> 72 </script> 73 <?php 74 } 75 ?> 76 <form action="index.php" name="templateform" method="post"> 77 <?php 78 echo mosHTML::selectList( $darray, 'jos_change_template', "id=\"mod_templatechooser_jos_change_template\" class=\"button\" onchange=\"$onchange\"",'value', 'text', $cur_template ); 79 ?> 80 <input class="button" type="submit" value="<?php echo _CMN_SELECT;?>" /> 81 </form>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |