| 3 |
* @package Mambo |
* @package Mambo |
| 4 |
* @author Mambo Foundation Inc see README.php |
* @author Mambo Foundation Inc see README.php |
| 5 |
* @copyright Mambo Foundation Inc. |
* @copyright Mambo Foundation Inc. |
| 6 |
|
* See COPYRIGHT.php for copyright notices and details. |
| 7 |
* @license GNU/GPL Version 2, see LICENSE.php |
* @license GNU/GPL Version 2, see LICENSE.php |
| 8 |
* Mambo is free software; you can redistribute it and/or |
* Mambo is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
* modify it under the terms of the GNU General Public License |
| 13 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 14 |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
| 15 |
|
|
| 16 |
global $cur_template; |
global $mainframe, $mosConfig_absolute_path; |
| 17 |
|
$cur_template = $mainframe->getTemplate(); |
| 18 |
|
|
| 19 |
// titlelength can be set in module params |
// titlelength can be set in module params |
| 20 |
$titlelength = $params->get( 'title_length', 20 ); |
$titlelength = $params->get( 'title_length', 20 ); |
| 28 |
$darray = array(); |
$darray = array(); |
| 29 |
if ($templatefolder) { |
if ($templatefolder) { |
| 30 |
while ($templatefile = $templatefolder->read()) { |
while ($templatefile = $templatefolder->read()) { |
| 31 |
if ($templatefile != "." && $templatefile != ".." && $templatefile != "CVS" && is_dir( "$template_path/$templatefile" ) ) { |
if ($templatefile != "." && $templatefile != ".." && $templatefile != "css" && is_dir( "$template_path/$templatefile" ) ) { |
| 32 |
if(strlen($templatefile) > $titlelength) { |
if(strlen($templatefile) > $titlelength) { |
| 33 |
$templatename = substr( $templatefile, 0, $titlelength-3 ); |
$templatename = substr( $templatefile, 0, $titlelength-3 ); |
| 34 |
$templatename .= "..."; |
$templatename .= "..."; |
| 43 |
|
|
| 44 |
sort( $darray ); |
sort( $darray ); |
| 45 |
|
|
| 46 |
// Show the preview image |
// Set up JavaScript for instant preview and show the preview image |
|
// Set up JavaScript for instant preview |
|
| 47 |
$onchange = ""; |
$onchange = ""; |
| 48 |
if ($show_preview) { |
if ($show_preview) { |
| 49 |
$onchange = "showimage()"; |
$onchange = "showimage();"; |
| 50 |
?> |
?> |
| 51 |
<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; ?>" /> |
<img src="<?php echo "templates/$cur_template/template_thumbnail.png";?>" id="templatePreview" width="<?php echo $preview_width;?>" height="<?php echo $preview_height;?>" alt="<?php echo $cur_template; ?>" /> |
| 52 |
<script language='JavaScript1.2' type='text/javascript'> |
<script type='text/javascript'> |
|
<!-- |
|
| 53 |
function showimage() { |
function showimage() { |
| 54 |
//if (!document.images) return; |
var tpimage=document.getElementById('templatePreview'); |
| 55 |
document.images.preview.src = 'templates/' + getSelectedValue( 'templateform', 'mos_change_template' ) + '/template_thumbnail.png'; |
tpimage.src = 'templates/' + getSelectedValue() + '/template_thumbnail.png'; |
| 56 |
} |
} |
| 57 |
function getSelectedValue( frmName, srcListName ) { |
function getSelectedValue() { |
| 58 |
var form = eval( 'document.' + frmName ); |
var srcList = document.getElementById('mos_change_template'); |
|
var srcList = eval( 'form.' + srcListName ); |
|
|
|
|
| 59 |
i = srcList.selectedIndex; |
i = srcList.selectedIndex; |
| 60 |
if (i != null && i > -1) { |
if (i != null && i > -1) { |
| 61 |
return srcList.options[i].value; |
return srcList.options[i].value; |
| 63 |
return null; |
return null; |
| 64 |
} |
} |
| 65 |
} |
} |
|
--> |
|
| 66 |
</script> |
</script> |
| 67 |
<?php |
<?php |
| 68 |
} |
} |
| 69 |
?> |
?> |
|
<form action="<?php echo $_SERVER['REQUEST_URI'];?>" name='templateform' method="post"> |
|
| 70 |
<?php |
<?php |
| 71 |
echo mosHTML::selectList( $darray, 'mos_change_template', "class=\"button\" onchange=\"$onchange\"",'value', 'text', $cur_template ); |
require_once($mosConfig_absolute_path.'/includes/phpInputFilter/class.inputfilter.php'); |
| 72 |
|
$iFilter = new InputFilter( null, null, 1, 1 ); |
| 73 |
|
$requestUri = trim($iFilter->process($_SERVER['REQUEST_URI'])); |
| 74 |
|
?> |
| 75 |
|
<form action="<?php echo $requestUri;?>" id='templateform' method="post"> |
| 76 |
|
<?php |
| 77 |
|
echo mosHTML::selectList( $darray, 'mos_change_template', "id=\"mos_change_template\"class=\"button\" onchange=\"$onchange\"",'value', 'text', $cur_template ); |
| 78 |
?> |
?> |
| 79 |
<input class="button" type="submit" value="<?php echo _CMN_SELECT;?>" /> |
<input class="button" type="submit" value="<?php echo 'Select';?>" /> |
| 80 |
</form> |
</form> |