📄 table.php
字号:
<?php
// ================================================
// SPAW PHP WYSIWYG editor control
// ================================================
// Table properties dialog
// ================================================
// Developed: Alan Mendelevich, alan@solmetra.lt
// Copyright: Solmetra (c)2003 All rights reserved.
// ------------------------------------------------
// www.solmetra.com
// ================================================
// v.1.0, 2003-04-01
// ================================================
// include wysiwyg config
include '../config/spaw_control.config.php';
include $spaw_root.'class/util.class.php';
include $spaw_root.'class/lang.class.php';
$theme = empty($HTTP_GET_VARS['theme'])?$spaw_default_theme:$HTTP_GET_VARS['theme'];
$theme_path = $spaw_dir.'lib/themes/'.$theme.'/';
$l = new SPAW_Lang($HTTP_GET_VARS['lang']);
$l->setBlock('table_prop');
$request_uri = urldecode(empty($HTTP_POST_VARS['request_uri'])?(empty($HTTP_GET_VARS['request_uri'])?'':$HTTP_GET_VARS['request_uri']):$HTTP_POST_VARS['request_uri']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<title><?php echo $l->m('title')?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $l->getCharset()?>">
<link rel="stylesheet" type="text/css" href="<?php echo $theme_path.'css/'?>dialog.css">
<?php if (SPAW_Util::getBrowser() == 'Gecko') { ?>
<script language="javascript" src="utils.gecko.js"></script>
<?php }else{ ?>
<script language="javascript" src="utils.js"></script>
<?php } ?>
<script language="javascript">
<!--
function showColorPicker(curcolor) {
<?php if (SPAW_Util::getBrowser() == 'Gecko') { ?>
var wnd = window.open('<?php echo $spaw_dir?>dialogs/colorpicker.php?lang=<?php echo $_GET["lang"]?>&theme=<?php echo $_GET["theme"]?>&editor=<?php echo $_GET["editor"]?>&callback=showColorPicker_callback',
"color_picker",
'status=no,modal=yes,width=350,height=250');
wnd.dialogArguments = curcolor;
<?php }else{ ?>
var newcol = showModalDialog('colorpicker.php?theme=<?php echo $theme?>&lang=<?php echo $l->lang?>', curcolor,
'dialogHeight:250px; dialogWidth:366px; resizable:no; status:no');
try {
table_prop.tbgcolor.value = newcol;
table_prop.color_sample.style.backgroundColor = table_prop.tbgcolor.value;
}
catch (excp) {}
<?php } ?>
}
function showColorPicker_callback(editor, sender)
{
var bCol = sender.returnValue;
try
{
document.getElementById('tbgcolor').value = bCol;
document.getElementById('color_sample').style.backgroundColor = document.getElementById('tbgcolor').value;
}
catch (excp) {}
}
function showImgPicker()
{
<?php if (SPAW_Util::getBrowser() == 'Gecko') { ?>
var wnd = window.open('<?php echo $spaw_dir?>dialogs/img_library.php?lang=<?php echo $_GET["lang"]?>&theme=<?php echo $_GET["theme"]?>&editor=<?php echo $_GET["editor"]?>&callback=showImgPicker_callback',
"img_library",
'status=no,modal=yes,width=420,height=420');
<?php }else{ ?>
var imgSrc = showModalDialog('<?php echo $spaw_dir?>dialogs/img_library.php?theme=<?php echo $theme?>&lang=<?php echo $l->lang?>&request_uri=<?php echo $request_uri?>', '',
'dialogHeight:420px; dialogWidth:420px; resizable:no; status:no');
if(imgSrc != null)
{
table_prop.tbackground.value = imgSrc;
}
<?php } ?>
}
function showImgPicker_callback(editor, sender)
{
var imgSrc = sender.returnValue;
if(imgSrc != null)
{
document.getElementById('tbackground').value = imgSrc;
}
}
function Init() {
var tProps = window.dialogArguments;
if (tProps)
{
// set attribute values
document.getElementById('trows').value = '3';
document.getElementById('trows').disabled = true;
document.getElementById('tcols').value = '3';
document.getElementById('tcols').disabled = true;
document.getElementById('tborder').value = tProps.border;
document.getElementById('tcpad').value = tProps.cellPadding;
document.getElementById('tcspc').value = tProps.cellSpacing;
document.getElementById('tbgcolor').value = tProps.bgColor;
document.getElementById('color_sample').style.backgroundColor = document.getElementById('tbgcolor').value;
document.getElementById('tbackground').value = tProps.background;
if (tProps.width) {
if (!isNaN(tProps.width) || (tProps.width.substr(tProps.width.length-2,2).toLowerCase() == "px"))
{
// pixels
if (!isNaN(tProps.width))
document.getElementById('twidth').value = tProps.width;
else
document.getElementById('twidth').value = tProps.width.substr(0,tProps.width.length-2);
document.getElementById('twunits').options[0].selected = false;
document.getElementById('twunits').options[1].selected = true;
}
else
{
// percents
document.getElementById('twidth').value = tProps.width.substr(0,tProps.width.length-1);
document.getElementById('twunits').options[0].selected = true;
document.getElementById('twunits').options[1].selected = false;
}
}
if (tProps.height) {
if (!isNaN(tProps.height) || (tProps.height.substr(tProps.height.length-2,2).toLowerCase() == "px"))
{
// pixels
if (!isNaN(tProps.height))
document.getElementById('theight').value = tProps.height;
else
document.getElementById('theight').value = tProps.height.substr(0,tProps.height.length-2);
document.getElementById('thunits').options[0].selected = false;
document.getElementById('thunits').options[1].selected = true;
}
else
{
// percents
document.getElementById('theight').value = tProps.height.substr(0,tProps.height.length-1);
document.getElementById('thunits').options[0].selected = true;
document.getElementById('thunits').options[1].selected = false;
}
}
if (tProps.className) {
document.getElementById('tcssclass').value = tProps.className;
css_class_changed();
}
}
else
{
// set default values
document.getElementById('trows').value = '3';
document.getElementById('tcols').value = '3';
document.getElementById('tborder').value = '1';
}
resizeDialogToContent();
}
function validateParams()
{
// check whether rows and cols are integers
if (isNaN(parseInt(document.getElementById('trows').value)))
{
alert('<?php echo $l->m('error').': '.$l->m('error_rows_nan')?>');
document.getElementById('trows').focus();
return false;
}
if (isNaN(parseInt(document.getElementById('tcols').value)))
{
alert('<?php echo $l->m('error').': '.$l->m('error_columns_nan')?>');
document.getElementById('tcols').focus();
return false;
}
// check width and height
if (isNaN(parseInt(document.getElementById('twidth').value)) && document.getElementById('twidth').value != '')
{
alert('<?php echo $l->m('error').': '.$l->m('error_width_nan')?>');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -