$Date: 2007-03-29 06:52:02 -0400 (Thu, 29 Mar 2007) $
| > $Revision: 911 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Admin Template functions library
| > Script written by Matt Mecham
| > Date started: 19th November 2003
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "
Incorrect access You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class admin_template_functions
{
var $menu_fontchange = "";
var $menu_sizechange = "";
var $menu_backchange = "";
var $menu_fontcolor = "";
var $menu_widthchange = "";
var $menu_highchange = "";
var $default_css = "";
var $type = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function admin_template_functions()
{
$this->default_css = "font-family:Verdana;font-size:11pt;color:black;background-color:white;border:3px outset #555";
}
//-----------------------------------------
// Build generic editor
//-----------------------------------------
function build_generic_editor_area( $data )
{
$return = "";
$return .= $this->html_build_editor_top();
$return .= "
";
$return .= "
".$this->ipsclass->adskin->form_textarea("txt{$data['textareaname']}", $data['textareainput'], '', '', 'none', "txt{$data['textareaname']}", $this->default_css )."
\n";
$return .= $this->html_build_editor_bottom() . "
";
return $return;
}
//-----------------------------------------
// Build editor text area table
//-----------------------------------------
function build_editor_area( $html, $template=array(), $img="" )
{
$return = "";
$edit_prefs = $this->type == 'single' ? $this->editor_prefs_dropdown : '';
$close_box = $this->type == 'single' ? " " : '';
$template['func_data'] = str_replace( "'", ''', $template['func_data'] );
$spiffy_diffy = "";
$return .= <<
EOF;
$return .= "".$this->ipsclass->adskin->form_textarea("txt{$template['suid']}", $html, 60, 5, 'none', "t{$template['suid']}", $this->default_css, 'onkeypress="parent.template_bit_changed(\'t'.$template['suid'].'\')"' )."
\n";
$return .= "";
return $return;
}
//-----------------------------------------
// Build JS for floated window
//-----------------------------------------
function build_editor_area_floated($no_buttons=0)
{
$return = "";
$this->ipsclass->html = $return;
$this->ipsclass->admin->print_popup();
}
//-----------------------------------------
// Build editor preferences menus
//-----------------------------------------
function build_editor_pref_menus()
{
$this->menu_fontchange = "".
"Monaco ".
"Courier ".
"Verdana ".
"Arial ".
" ";
$this->menu_sizechange = "".
"8pt ".
"9pt ".
"10pt ".
"11pt ".
"12pt ".
" ";
$this->menu_backchange = "".
"Black ".
"White ".
"Light Gray ".
"Gray ".
" ";
$this->menu_fontcolor = "".
"Black ".
"White ".
"Blue ".
"Light Green ".
"Green ".
"Dark Green ".
"Gray ".
" ";
$this->menu_widthchange = "".
"100% ".
"90% ".
"80% ".
"70% ".
"60% ".
"50% ".
" ";
//-----------------------------------------
// Not single?
//-----------------------------------------
if ( $this->type != 'single' AND $this->type != 'multiple' )
{
$this->menu_highchange = "".
"50px ".
"100px ".
"200px ".
"300px ".
"400px ".
"500px ".
"600px ".
"700px ".
"800px ".
"900px ".
"1000px ".
" ";
}
else
{
$this->menu_highchange = "N/A ";
}
if ( $cookie = $this->ipsclass->my_getcookie( 'acpeditorprefs' ) )
{
list( $font, $size, $bg, $fc, $width, $height ) = explode( "," ,$cookie );
}
else
{
//-----------------------------------------
// Decent defaults
//-----------------------------------------
$font = 'monaco';
$size = '8pt';
$bg = 'white';
$fc = 'black';
$width = '100%';
$height = '300px';
}
//-----------------------------------------
// Force decent height if single
//-----------------------------------------
if ( $this->type == 'single' OR $this->type == 'multiple' )
{
$height = '300px';
}
//-----------------------------------------
// Show..
//-----------------------------------------
$this->default_css = "font-family:$font;font-size:$size;color:$fc;background-color:$bg;width:$width;height:$height;border:3px outset #555";
$this->menu_fontchange = preg_replace( "/(option value='".preg_quote($font)."')/" , "\\1 selected='selected'", $this->menu_fontchange );
$this->menu_sizechange = preg_replace( "/(option value='".preg_quote($size)."')/" , "\\1 selected='selected'", $this->menu_sizechange );
$this->menu_backchange = preg_replace( "/(option value='".preg_quote($bg)."')/" , "\\1 selected='selected'", $this->menu_backchange );
$this->menu_fontcolor = preg_replace( "/(option value='".preg_quote($fc)."')/" , "\\1 selected='selected'", $this->menu_fontcolor );
$this->menu_widthchange = preg_replace( "/(option value='".preg_quote($width)."')/" , "\\1 selected='selected'", $this->menu_widthchange );
$this->menu_highchange = preg_replace( "/(option value='".preg_quote($height)."')/" , "\\1 selected='selected'", $this->menu_highchange );
$this->editor_prefs_dropdown = "";
}
function html_build_editor_top()
{
$this->build_editor_pref_menus();
if ( $this->type == 'single' )
{
return "";
}
$close_box = $this->type == 'multiple' ? "
" : '';
return <<
EOF;
}
function html_build_editor_bottom()
{
return <<
menu_build_menu(
'tmpl-editor-prefs',
new Array( ""
) );
\n
EOF;
}
}
?>