| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 global $mainframe, $mosConfig_live_site; 20 $cur_template = $mainframe->getTemplate(); 21 22 // titlelength can be set in module params 23 $titlelength = $params->get( 'title_length', 20 ); 24 $preview_height = $params->get( 'preview_height', 90 ); 25 $preview_width = $params->get( 'preview_width', 140 ); 26 $show_preview = $params->get( 'show_preview', 0 ); 27 28 // Read files from template directory 29 $template_path = "$mosConfig_absolute_path/templates"; 30 $templatefolder = @dir( $template_path ); 31 $darray = array(); 32 if ($templatefolder) { 33 while ($templatefile = $templatefolder->read()) { 34 if ($templatefile != "." && $templatefile != ".." && $templatefile != "css" && is_dir( "$template_path/$templatefile" ) ) { 35 if(strlen($templatefile) > $titlelength) { 36 $templatename = substr( $templatefile, 0, $titlelength-3 ); 37 $templatename .= "..."; 38 } else { 39 $templatename = $templatefile; 40 } 41 $darray[] = mosHTML::makeOption( $templatefile, $templatename ); 42 } 43 } 44 $templatefolder->close(); 45 } 46 47 sort( $darray ); 48 49 // Set up JavaScript for instant preview and show the preview image 50 $onchange = ""; 51 if ($show_preview) { 52 $onchange = "showimage();"; 53 ?> 54 <img src="<?php echo " $mosConfig_live_site/templates/$cur_template/template_thumbnail.png";?>" id="templatePreview" width="<?php echo $preview_width;?>" height="<?php echo $preview_height;?>" alt="<?php echo $cur_template; ?>" /> 55 <script type='text/javascript'> 56 function showimage() { 57 var tpimage=document.getElementById('templatePreview'); 58 tpimage.src = <?php echo "'".$mosConfig_live_site."'";?> + '/templates/' + getSelectedValue() + '/template_thumbnail.png'; 59 } 60 function getSelectedValue() { 61 var srcList = document.getElementById('mos_change_template'); 62 i = srcList.selectedIndex; 63 if (i != null && i > -1) { 64 return srcList.options[i].value; 65 } else { 66 return null; 67 } 68 } 69 </script> 70 <?php 71 } 72 ?> 73 <?php 74 require_once(mamboCore::get('mosConfig_absolute_path').'/includes/phpInputFilter/class.inputfilter.php'); 75 $iFilter = new InputFilter( null, null, 1, 1 ); 76 $requestUri = htmlspecialchars(trim($iFilter->process(mosGetParam ($_SERVER,'QUERY_STRING','')))); 77 $requestUri = $requestUri!='' ? 'index.php?'.$requestUri : 'index.php'; 78 ?> 79 <form action="<?php echo sefRelToAbs($requestUri);?>" id='templateform' method="post"> 80 <?php 81 echo mosHTML::selectList( $darray, 'mos_change_template', "id=\"mos_change_template\" class=\"button\" onchange=\"$onchange\"",'value', 'text', $cur_template ); 82 ?> 83 <input class="button" type="submit" value="<?php echo T_('Select');?>" /> 84 </form>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |