Set eol-style to native.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-01-16 17:52:13 +00:00
parent 189f061cd8
commit 132569c301
28 changed files with 4095 additions and 4095 deletions

View File

@ -1,397 +1,397 @@
<?php
function kubrick_head() {
$head = "<style type='text/css'>\n<!--";
$output = '';
if ( kubrick_header_image() ) {
$url = kubrick_header_image_url() ;
$output .= "#header { background: url('$url') no-repeat bottom center; }\n";
}
if ( false !== ( $color = kubrick_header_color() ) ) {
$output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
}
if ( false !== ( $display = kubrick_header_display() ) ) {
$output .= "#headerimg { display: $display }\n";
}
$foot = "--></style>\n";
if ( '' != $output )
echo $head . $output . $foot;
}
add_action('wp_head', 'kubrick_head');
function kubrick_header_image() {
return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
}
function kubrick_upper_color() {
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['upper'];
} else
return '69aee7';
}
function kubrick_lower_color() {
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['lower'];
} else
return '4180b6';
}
function kubrick_header_image_url() {
if ( $image = kubrick_header_image() )
$url = get_template_directory_uri() . '/images/' . $image;
else
$url = get_template_directory_uri() . '/images/kubrickheader.jpg';
return $url;
}
function kubrick_header_color() {
return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
}
function kubrick_header_color_string() {
$color = kubrick_header_color();
if ( false === $color )
return 'white';
return $color;
}
function kubrick_header_display() {
return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
}
function kubrick_header_display_string() {
$display = kubrick_header_display();
return $display ? $display : 'inline';
}
add_action('admin_menu', 'kubrick_add_theme_page');
function kubrick_add_theme_page() {
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
if ( isset($_REQUEST['njform']) ) {
if ( isset($_REQUEST['defaults']) ) {
delete_option('kubrick_header_image');
delete_option('kubrick_header_color');
delete_option('kubrick_header_display');
} else {
if ( '' == $_REQUEST['njfontcolor'] )
delete_option('kubrick_header_color');
else
update_option('kubrick_header_color', $_REQUEST['njfontcolor']);
if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
update_option('kubrick_header_image', "header-img.php?upper=$uc&amp;lower=$lc");
}
if ( isset($_REQUEST['toggledisplay']) ) {
if ( false === get_option('kubrick_header_display') )
update_option('kubrick_header_display', 'none');
else
delete_option('kubrick_header_display');
}
}
} else {
if ( isset($_REQUEST['headerimage']) ) {
if ( '' == $_REQUEST['headerimage'] )
delete_option('kubrick_header_image');
else
update_option('kubrick_header_image', $_REQUEST['headerimage']);
}
if ( isset($_REQUEST['fontcolor']) ) {
if ( '' == $_REQUEST['fontcolor'] )
delete_option('kubrick_header_color');
else
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
}
if ( isset($_REQUEST['fontdisplay']) ) {
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('kubrick_header_display');
else
update_option('kubrick_header_display', 'none');
}
}
//print_r($_REQUEST);
wp_redirect("themes.php?page=functions.php&saved=true");
die;
}
add_action('admin_head', 'kubrick_theme_page_head');
}
add_theme_page('Customize Header', 'Header Image and Color', 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
}
function kubrick_theme_page_head() {
?>
<script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
<script type='text/javascript'>
// <![CDATA[
function pickColor(color) {
ColorPicker_targetInput.value = color;
kUpdate(ColorPicker_targetInput.id);
}
function PopupWindow_populate(contents) {
contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" value="Close Color Picker" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
this.contents = contents;
this.populated = false;
}
function PopupWindow_hidePopup(magicword) {
if ( magicword != 'prettyplease' )
return false;
if (this.divName != null) {
if (this.use_gebi) {
document.getElementById(this.divName).style.visibility = "hidden";
}
else if (this.use_css) {
document.all[this.divName].style.visibility = "hidden";
}
else if (this.use_layers) {
document.layers[this.divName].visibility = "hidden";
}
}
else {
if (this.popupWindow && !this.popupWindow.closed) {
this.popupWindow.close();
this.popupWindow = null;
}
}
return false;
}
function colorSelect(t,p) {
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
cp.hidePopup('prettyplease');
else {
cp.p = p;
cp.select(t,p);
}
}
function PopupWindow_setSize(width,height) {
this.width = 162;
this.height = 210;
}
var cp = new ColorPicker();
function advUpdate(val, obj) {
document.getElementById(obj).value = val;
kUpdate(obj);
}
function kUpdate(oid) {
if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
uc = document.getElementById('uppercolor').value.replace('#', '');
lc = document.getElementById('lowercolor').value.replace('#', '');
hi = document.getElementById('headerimage');
hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
document.getElementById('advuppercolor').value = '#'+uc;
document.getElementById('advlowercolor').value = '#'+lc;
}
if ( 'fontcolor' == oid ) {
document.getElementById('header').style.color = document.getElementById('fontcolor').value;
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
}
if ( 'fontdisplay' == oid ) {
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
}
function toggleDisplay() {
td = document.getElementById('fontdisplay');
td.value = ( td.value == 'none' ) ? 'inline' : 'none';
kUpdate('fontdisplay');
}
function toggleAdvanced() {
a = document.getElementById('jsAdvanced');
if ( a.style.display == 'none' )
a.style.display = 'block';
else
a.style.display = 'none';
}
function kDefaults() {
document.getElementById('headerimage').value = '';
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
document.getElementById('header').style.color = '#FFFFFF';
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
document.getElementById('fontdisplay').value = 'inline';
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
function kRevert() {
document.getElementById('headerimage').value = '<?php echo kubrick_header_image(); ?>';
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo kubrick_upper_color(); ?>';
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo kubrick_lower_color(); ?>';
document.getElementById('header').style.background = 'url("<?php echo kubrick_header_image_url(); ?>") center no-repeat';
document.getElementById('header').style.color = '';
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo kubrick_header_color_string(); ?>';
document.getElementById('fontdisplay').value = '<?php echo kubrick_header_display_string(); ?>';
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
function kInit() {
document.getElementById('jsForm').style.display = 'block';
document.getElementById('nonJsForm').style.display = 'none';
}
addLoadEvent(kInit);
// ]]>
</script>
<style type='text/css'>
#headwrap {
text-align: center;
}
#kubrick-header {
font-size: 80%;
}
#kubrick-header .hibrowser {
width: 780px;
height: 260px;
overflow: scroll;
}
#kubrick-header #hitarget {
display: none;
}
#kubrick-header #header h1 {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
font-size: 4em;
text-align: center;
padding-top: 70px;
margin: 0;
}
#kubrick-header #header .description {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 1.2em;
text-align: center;
}
#kubrick-header #header {
text-decoration: none;
color: <?php echo kubrick_header_color_string(); ?>;
padding: 0;
margin: 0;
height: 200px;
text-align: center;
background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
}
#kubrick-header #headerimg {
margin: 0;
height: 200px;
width: 100%;
display: <?php echo kubrick_header_display_string(); ?>;
}
#jsForm {
display: none;
text-align: center;
}
#jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
padding: 0px;
margin: 0px;
}
#advanced {
text-align: center;
width: 620px;
}
html>body #advanced {
text-align: center;
position: relative;
left: 50%;
margin-left: -380px;
}
#jsAdvanced {
text-align: right;
}
#nonJsForm {
position: relative;
text-align: left;
margin-left: -370px;
left: 50%;
}
#nonJsForm label {
padding-top: 6px;
padding-right: 5px;
float: left;
width: 100px;
text-align: right;
}
.defbutton {
font-weight: bold;
}
.zerosize {
width: 0px;
height: 0px;
overflow: hidden;
}
#colorPickerDiv a, #colorPickerDiv a:hover {
padding: 1px;
text-decoration: none;
border-bottom: 0px;
}
</style>
<?php
}
function kubrick_theme_page() {
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>Options saved.</strong></p></div>';
?>
<div class='wrap'>
<div id="kubrick-header">
<h2>Header Image and Color</h2>
<div id="headwrap">
<div id="header">
<div id="headerimg">
<h1><?php bloginfo('name'); ?></h1>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
</div>
<br />
<div id="nonJsForm">
<form method="post" action="">
<div class="zerosize"><input type="submit" name="defaultsubmit" value="Save" /></div>
<label for="njfontcolor">Font Color:</label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo kubrick_header_color(); ?>" /> Any CSS color (<code>red</code> or <code>#FF0000</code> or <code>rgb(255, 0, 0)</code>)<br />
<label for="njuppercolor">Upper Color:</label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo kubrick_upper_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
<label for="njlowercolor">Lower Color:</label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo kubrick_lower_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
<input type="hidden" name="hi" id="hi" value="<?php echo kubrick_header_image(); ?>" />
<input type="submit" name="toggledisplay" id="toggledisplay" value="Toggle Text" />
<input type="submit" name="defaults" value="Use Defaults" />
<input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;Save&nbsp;&nbsp;" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="njform" value="true" />
</form>
</div>
<div id="jsForm">
<form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<input type="button" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="Font Color"></input>
<input type="button" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="Upper Color"></input>
<input type="button" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="Lower Color"></input>
<input type="button" name="revert" value="Revert" onclick="kRevert()" />
<input type="button" value="Advanced" onclick="toggleAdvanced()" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo kubrick_header_display(); ?>" />
<input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo kubrick_header_color(); ?>" />
<input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo kubrick_upper_color(); ?>" />
<input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo kubrick_lower_color(); ?>" />
<input type="hidden" name="headerimage" id="headerimage" value="<?php echo kubrick_header_image(); ?>" />
<p class="submit"><input type="submit" name="submitform" class="defbutton" value="<?php _e('Update Header &raquo;'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
</form>
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
<div id="advanced">
<form id="jsAdvanced" style="display:none;" action="">
<label for="advfontcolor">Font Color (CSS): </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo kubrick_header_color(); ?>" /><br />
<label for="advuppercolor">Upper Color (HEX): </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo kubrick_upper_color(); ?>" /><br />
<label for="advlowercolor">Lower Color (HEX): </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo kubrick_lower_color(); ?>" /><br />
<input type="button" name="default" value="Select Default Colors" onclick="kDefaults()" /><br />
<input type="button" onclick="toggleDisplay();return false;" name="pick" id="pick" value="Toggle Text Display"></input><br />
</form>
</div>
</div>
</div>
</div>
<?php } ?>
<?php
function kubrick_head() {
$head = "<style type='text/css'>\n<!--";
$output = '';
if ( kubrick_header_image() ) {
$url = kubrick_header_image_url() ;
$output .= "#header { background: url('$url') no-repeat bottom center; }\n";
}
if ( false !== ( $color = kubrick_header_color() ) ) {
$output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
}
if ( false !== ( $display = kubrick_header_display() ) ) {
$output .= "#headerimg { display: $display }\n";
}
$foot = "--></style>\n";
if ( '' != $output )
echo $head . $output . $foot;
}
add_action('wp_head', 'kubrick_head');
function kubrick_header_image() {
return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
}
function kubrick_upper_color() {
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['upper'];
} else
return '69aee7';
}
function kubrick_lower_color() {
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
parse_str(substr($url, strpos($url, '?') + 1), $q);
return $q['lower'];
} else
return '4180b6';
}
function kubrick_header_image_url() {
if ( $image = kubrick_header_image() )
$url = get_template_directory_uri() . '/images/' . $image;
else
$url = get_template_directory_uri() . '/images/kubrickheader.jpg';
return $url;
}
function kubrick_header_color() {
return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
}
function kubrick_header_color_string() {
$color = kubrick_header_color();
if ( false === $color )
return 'white';
return $color;
}
function kubrick_header_display() {
return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
}
function kubrick_header_display_string() {
$display = kubrick_header_display();
return $display ? $display : 'inline';
}
add_action('admin_menu', 'kubrick_add_theme_page');
function kubrick_add_theme_page() {
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
if ( isset($_REQUEST['njform']) ) {
if ( isset($_REQUEST['defaults']) ) {
delete_option('kubrick_header_image');
delete_option('kubrick_header_color');
delete_option('kubrick_header_display');
} else {
if ( '' == $_REQUEST['njfontcolor'] )
delete_option('kubrick_header_color');
else
update_option('kubrick_header_color', $_REQUEST['njfontcolor']);
if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
update_option('kubrick_header_image', "header-img.php?upper=$uc&amp;lower=$lc");
}
if ( isset($_REQUEST['toggledisplay']) ) {
if ( false === get_option('kubrick_header_display') )
update_option('kubrick_header_display', 'none');
else
delete_option('kubrick_header_display');
}
}
} else {
if ( isset($_REQUEST['headerimage']) ) {
if ( '' == $_REQUEST['headerimage'] )
delete_option('kubrick_header_image');
else
update_option('kubrick_header_image', $_REQUEST['headerimage']);
}
if ( isset($_REQUEST['fontcolor']) ) {
if ( '' == $_REQUEST['fontcolor'] )
delete_option('kubrick_header_color');
else
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
}
if ( isset($_REQUEST['fontdisplay']) ) {
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
delete_option('kubrick_header_display');
else
update_option('kubrick_header_display', 'none');
}
}
//print_r($_REQUEST);
wp_redirect("themes.php?page=functions.php&saved=true");
die;
}
add_action('admin_head', 'kubrick_theme_page_head');
}
add_theme_page('Customize Header', 'Header Image and Color', 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
}
function kubrick_theme_page_head() {
?>
<script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
<script type='text/javascript'>
// <![CDATA[
function pickColor(color) {
ColorPicker_targetInput.value = color;
kUpdate(ColorPicker_targetInput.id);
}
function PopupWindow_populate(contents) {
contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" value="Close Color Picker" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
this.contents = contents;
this.populated = false;
}
function PopupWindow_hidePopup(magicword) {
if ( magicword != 'prettyplease' )
return false;
if (this.divName != null) {
if (this.use_gebi) {
document.getElementById(this.divName).style.visibility = "hidden";
}
else if (this.use_css) {
document.all[this.divName].style.visibility = "hidden";
}
else if (this.use_layers) {
document.layers[this.divName].visibility = "hidden";
}
}
else {
if (this.popupWindow && !this.popupWindow.closed) {
this.popupWindow.close();
this.popupWindow = null;
}
}
return false;
}
function colorSelect(t,p) {
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
cp.hidePopup('prettyplease');
else {
cp.p = p;
cp.select(t,p);
}
}
function PopupWindow_setSize(width,height) {
this.width = 162;
this.height = 210;
}
var cp = new ColorPicker();
function advUpdate(val, obj) {
document.getElementById(obj).value = val;
kUpdate(obj);
}
function kUpdate(oid) {
if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
uc = document.getElementById('uppercolor').value.replace('#', '');
lc = document.getElementById('lowercolor').value.replace('#', '');
hi = document.getElementById('headerimage');
hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
document.getElementById('advuppercolor').value = '#'+uc;
document.getElementById('advlowercolor').value = '#'+lc;
}
if ( 'fontcolor' == oid ) {
document.getElementById('header').style.color = document.getElementById('fontcolor').value;
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
}
if ( 'fontdisplay' == oid ) {
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
}
function toggleDisplay() {
td = document.getElementById('fontdisplay');
td.value = ( td.value == 'none' ) ? 'inline' : 'none';
kUpdate('fontdisplay');
}
function toggleAdvanced() {
a = document.getElementById('jsAdvanced');
if ( a.style.display == 'none' )
a.style.display = 'block';
else
a.style.display = 'none';
}
function kDefaults() {
document.getElementById('headerimage').value = '';
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
document.getElementById('header').style.color = '#FFFFFF';
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
document.getElementById('fontdisplay').value = 'inline';
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
function kRevert() {
document.getElementById('headerimage').value = '<?php echo kubrick_header_image(); ?>';
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo kubrick_upper_color(); ?>';
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo kubrick_lower_color(); ?>';
document.getElementById('header').style.background = 'url("<?php echo kubrick_header_image_url(); ?>") center no-repeat';
document.getElementById('header').style.color = '';
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo kubrick_header_color_string(); ?>';
document.getElementById('fontdisplay').value = '<?php echo kubrick_header_display_string(); ?>';
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
}
function kInit() {
document.getElementById('jsForm').style.display = 'block';
document.getElementById('nonJsForm').style.display = 'none';
}
addLoadEvent(kInit);
// ]]>
</script>
<style type='text/css'>
#headwrap {
text-align: center;
}
#kubrick-header {
font-size: 80%;
}
#kubrick-header .hibrowser {
width: 780px;
height: 260px;
overflow: scroll;
}
#kubrick-header #hitarget {
display: none;
}
#kubrick-header #header h1 {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
font-size: 4em;
text-align: center;
padding-top: 70px;
margin: 0;
}
#kubrick-header #header .description {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 1.2em;
text-align: center;
}
#kubrick-header #header {
text-decoration: none;
color: <?php echo kubrick_header_color_string(); ?>;
padding: 0;
margin: 0;
height: 200px;
text-align: center;
background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
}
#kubrick-header #headerimg {
margin: 0;
height: 200px;
width: 100%;
display: <?php echo kubrick_header_display_string(); ?>;
}
#jsForm {
display: none;
text-align: center;
}
#jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
padding: 0px;
margin: 0px;
}
#advanced {
text-align: center;
width: 620px;
}
html>body #advanced {
text-align: center;
position: relative;
left: 50%;
margin-left: -380px;
}
#jsAdvanced {
text-align: right;
}
#nonJsForm {
position: relative;
text-align: left;
margin-left: -370px;
left: 50%;
}
#nonJsForm label {
padding-top: 6px;
padding-right: 5px;
float: left;
width: 100px;
text-align: right;
}
.defbutton {
font-weight: bold;
}
.zerosize {
width: 0px;
height: 0px;
overflow: hidden;
}
#colorPickerDiv a, #colorPickerDiv a:hover {
padding: 1px;
text-decoration: none;
border-bottom: 0px;
}
</style>
<?php
}
function kubrick_theme_page() {
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>Options saved.</strong></p></div>';
?>
<div class='wrap'>
<div id="kubrick-header">
<h2>Header Image and Color</h2>
<div id="headwrap">
<div id="header">
<div id="headerimg">
<h1><?php bloginfo('name'); ?></h1>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
</div>
<br />
<div id="nonJsForm">
<form method="post" action="">
<div class="zerosize"><input type="submit" name="defaultsubmit" value="Save" /></div>
<label for="njfontcolor">Font Color:</label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo kubrick_header_color(); ?>" /> Any CSS color (<code>red</code> or <code>#FF0000</code> or <code>rgb(255, 0, 0)</code>)<br />
<label for="njuppercolor">Upper Color:</label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo kubrick_upper_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
<label for="njlowercolor">Lower Color:</label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo kubrick_lower_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
<input type="hidden" name="hi" id="hi" value="<?php echo kubrick_header_image(); ?>" />
<input type="submit" name="toggledisplay" id="toggledisplay" value="Toggle Text" />
<input type="submit" name="defaults" value="Use Defaults" />
<input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;Save&nbsp;&nbsp;" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="njform" value="true" />
</form>
</div>
<div id="jsForm">
<form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<input type="button" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="Font Color"></input>
<input type="button" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="Upper Color"></input>
<input type="button" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="Lower Color"></input>
<input type="button" name="revert" value="Revert" onclick="kRevert()" />
<input type="button" value="Advanced" onclick="toggleAdvanced()" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo kubrick_header_display(); ?>" />
<input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo kubrick_header_color(); ?>" />
<input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo kubrick_upper_color(); ?>" />
<input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo kubrick_lower_color(); ?>" />
<input type="hidden" name="headerimage" id="headerimage" value="<?php echo kubrick_header_image(); ?>" />
<p class="submit"><input type="submit" name="submitform" class="defbutton" value="<?php _e('Update Header &raquo;'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
</form>
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
<div id="advanced">
<form id="jsAdvanced" style="display:none;" action="">
<label for="advfontcolor">Font Color (CSS): </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo kubrick_header_color(); ?>" /><br />
<label for="advuppercolor">Upper Color (HEX): </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo kubrick_upper_color(); ?>" /><br />
<label for="advlowercolor">Lower Color (HEX): </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo kubrick_lower_color(); ?>" /><br />
<input type="button" name="default" value="Select Default Colors" onclick="kDefaults()" /><br />
<input type="button" onclick="toggleDisplay();return false;" name="pick" id="pick" value="Toggle Text Display"></input><br />
</form>
</div>
</div>
</div>
</div>
<?php } ?>

View File

@ -1,41 +1,41 @@
// UK lang variables
tinyMCE.addToLang('',{
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
striketrough_desc : 'Strikethrough',
justifyleft_desc : 'Align left',
justifycenter_desc : 'Align center',
justifyright_desc : 'Align right',
justifyfull_desc : 'Align full',
bullist_desc : 'Unordered list',
numlist_desc : 'Ordered list',
outdent_desc : 'Outdent',
indent_desc : 'Indent',
undo_desc : 'Undo (Ctrl+Z)',
redo_desc : 'Redo (Ctrl+Y)',
link_desc : 'Insert/edit link',
unlink_desc : 'Unlink',
image_desc : 'Insert/edit image',
cleanup_desc : 'Cleanup messy code',
focus_alert : 'A editor instance must be focused before using this command.',
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
insert_link_title : 'Insert/edit link',
insert : 'Insert',
update : 'Update',
cancel : 'Cancel',
insert_link_url : 'Link URL',
insert_link_target : 'Target',
insert_link_target_same : 'Open link in the same window',
insert_link_target_blank : 'Open link in a new window',
insert_image_title : 'Insert/edit image',
insert_image_src : 'Image URL',
insert_image_alt : 'Image description',
help_desc : 'Help',
bold_img : "bold.gif",
italic_img : "italic.gif",
underline_img : "underline.gif",
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
});
// UK lang variables
tinyMCE.addToLang('',{
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
striketrough_desc : 'Strikethrough',
justifyleft_desc : 'Align left',
justifycenter_desc : 'Align center',
justifyright_desc : 'Align right',
justifyfull_desc : 'Align full',
bullist_desc : 'Unordered list',
numlist_desc : 'Ordered list',
outdent_desc : 'Outdent',
indent_desc : 'Indent',
undo_desc : 'Undo (Ctrl+Z)',
redo_desc : 'Redo (Ctrl+Y)',
link_desc : 'Insert/edit link',
unlink_desc : 'Unlink',
image_desc : 'Insert/edit image',
cleanup_desc : 'Cleanup messy code',
focus_alert : 'A editor instance must be focused before using this command.',
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
insert_link_title : 'Insert/edit link',
insert : 'Insert',
update : 'Update',
cancel : 'Cancel',
insert_link_url : 'Link URL',
insert_link_target : 'Target',
insert_link_target_same : 'Open link in the same window',
insert_link_target_blank : 'Open link in a new window',
insert_image_title : 'Insert/edit image',
insert_image_src : 'Image URL',
insert_image_alt : 'Image description',
help_desc : 'Help',
bold_img : "bold.gif",
italic_img : "italic.gif",
underline_img : "underline.gif",
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
});

View File

@ -1,46 +1,46 @@
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave');
var TinyMCE_AutoSavePlugin = {
getInfo : function() {
return {
longname : 'Auto save',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
// Private plugin internal methods
_beforeUnloadHandler : function() {
var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
if (tinyMCE.getParam("fullscreen_is_enabled"))
return;
for (n in tinyMCE.instances) {
inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;
}
return;
}
};
window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave');
var TinyMCE_AutoSavePlugin = {
getInfo : function() {
return {
longname : 'Auto save',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
// Private plugin internal methods
_beforeUnloadHandler : function() {
var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
if (tinyMCE.getParam("fullscreen_is_enabled"))
return;
for (n in tinyMCE.instances) {
inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;
}
return;
}
};
window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);

View File

@ -1,30 +1,30 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
function TinyMCE_autosave_getInfo() {
return {
longname : 'Auto save',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
};
function TinyMCE_autosave_beforeUnloadHandler() {
var msg = tinyMCE.getLang("lang_autosave_unload_msg");
var anyDirty = false;
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;
}
return;
}
window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
function TinyMCE_autosave_getInfo() {
return {
longname : 'Auto save',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
};
function TinyMCE_autosave_beforeUnloadHandler() {
var msg = tinyMCE.getLang("lang_autosave_unload_msg");
var anyDirty = false;
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;
}
return;
}
window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;

View File

@ -1,5 +1,5 @@
// EN lang variables
tinyMCE.addToLang('',{
autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
});
// EN lang variables
tinyMCE.addToLang('',{
autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
});

View File

@ -1,90 +1,90 @@
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('directionality');
var TinyMCE_DirectionalityPlugin = {
getInfo : function() {
return {
longname : 'Directionality',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
getControlHTML : function(cn) {
switch (cn) {
case "ltr":
return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
case "rtl":
return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
}
return "";
},
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceDirectionLTR":
var inst = tinyMCE.getInstanceById(editor_id);
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (elm)
elm.setAttribute("dir", "ltr");
tinyMCE.triggerNodeChange(false);
return true;
case "mceDirectionRTL":
var inst = tinyMCE.getInstanceById(editor_id);
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (elm)
elm.setAttribute("dir", "rtl");
tinyMCE.triggerNodeChange(false);
return true;
}
// Pass to next handler in chain
return false;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
if (node == null)
return;
var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (!elm) {
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
return true;
}
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
var dir = getAttrib(elm, "dir");
if (dir == "ltr" || dir == "")
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
else
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
return true;
}
};
tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('directionality');
var TinyMCE_DirectionalityPlugin = {
getInfo : function() {
return {
longname : 'Directionality',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
getControlHTML : function(cn) {
switch (cn) {
case "ltr":
return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
case "rtl":
return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
}
return "";
},
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceDirectionLTR":
var inst = tinyMCE.getInstanceById(editor_id);
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (elm)
elm.setAttribute("dir", "ltr");
tinyMCE.triggerNodeChange(false);
return true;
case "mceDirectionRTL":
var inst = tinyMCE.getInstanceById(editor_id);
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (elm)
elm.setAttribute("dir", "rtl");
tinyMCE.triggerNodeChange(false);
return true;
}
// Pass to next handler in chain
return false;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
if (node == null)
return;
var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
if (!elm) {
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
return true;
}
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
var dir = getAttrib(elm, "dir");
if (dir == "ltr" || dir == "")
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
else
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
return true;
}
};
tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);

View File

@ -1,6 +1,6 @@
// UK lang variables
tinyMCE.addToLang('',{
directionality_ltr_desc : 'Direction left to right (Alt-.)',
directionality_rtl_desc : 'Direction right to left (Alt-,)'
});
// UK lang variables
tinyMCE.addToLang('',{
directionality_ltr_desc : 'Direction left to right (Alt-.)',
directionality_rtl_desc : 'Direction right to left (Alt-,)'
});

File diff suppressed because it is too large Load Diff

View File

@ -1,453 +1,453 @@
/**
* $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
// Windows handler
function MCWindows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
};
MCWindows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
};
MCWindows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCWindows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
}
MCWindows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
MCWindows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
MCWindows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = 10;
options['top'] = 10;
options['width'] = 300;
options['height'] = 300;
options['resizable'] = true;
options['minimizable'] = true;
options['maximizable'] = true;
options['close'] = true;
options['movable'] = true;
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
return options;
};
MCWindows.prototype.open = function(url, name, features) {
var win = new MCWindow();
var winDiv, html = "", id;
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
width = parseInt(features['width']);
height = parseInt(features['height'])-12-19;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
html += '</div>';
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Gets called when wrapper iframe is initialized
MCWindows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name + "_iframe";
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
this.selectedWindow = win;
};
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function MCWindow() {
};
MCWindow.prototype.focus = function() {
this.winElement.style.zIndex = mcWindows.zindex++;
mcWindows.selectedWindow = this;
};
MCWindow.prototype.minimize = function() {
};
MCWindow.prototype.maximize = function() {
};
MCWindow.prototype.startResize = function() {
mcWindows.action = "resize";
};
MCWindow.prototype.startMove = function(e) {
mcWindows.action = "move";
};
MCWindow.prototype.close = function() {
document.body.removeChild(this.winElement);
mcWindows.windows[this.name] = null;
};
MCWindow.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height-12-19;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
MCWindow.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id) {
win.focus();
return;
}
}
};
MCWindow.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new MCWindows();
/**
* $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
*/
// Windows handler
function MCWindows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
};
MCWindows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
};
MCWindows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCWindows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
}
MCWindows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
MCWindows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
MCWindows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = 10;
options['top'] = 10;
options['width'] = 300;
options['height'] = 300;
options['resizable'] = true;
options['minimizable'] = true;
options['maximizable'] = true;
options['close'] = true;
options['movable'] = true;
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
return options;
};
MCWindows.prototype.open = function(url, name, features) {
var win = new MCWindow();
var winDiv, html = "", id;
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
width = parseInt(features['width']);
height = parseInt(features['height'])-12-19;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
html += '</div>';
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Gets called when wrapper iframe is initialized
MCWindows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name + "_iframe";
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
this.selectedWindow = win;
};
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function MCWindow() {
};
MCWindow.prototype.focus = function() {
this.winElement.style.zIndex = mcWindows.zindex++;
mcWindows.selectedWindow = this;
};
MCWindow.prototype.minimize = function() {
};
MCWindow.prototype.maximize = function() {
};
MCWindow.prototype.startResize = function() {
mcWindows.action = "resize";
};
MCWindow.prototype.startMove = function(e) {
mcWindows.action = "move";
};
MCWindow.prototype.close = function() {
document.body.removeChild(this.winElement);
mcWindows.windows[this.name] = null;
};
MCWindow.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height-12-19;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
MCWindow.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id) {
win.focus();
return;
}
}
};
MCWindow.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new MCWindows();

View File

@ -1,385 +1,385 @@
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('paste');
var TinyMCE_PastePlugin = {
getInfo : function() {
return {
longname : 'Paste text/word',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
},
getControlHTML : function(cn) {
switch (cn) {
case "pastetext":
return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
case "pasteword":
return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
case "selectall":
return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
}
return '';
},
execCommand : function(editor_id, element, command, user_interface, value) {
switch (command) {
case "mcePasteText":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
else {
var template = new Array();
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
return true;
case "mcePasteWord":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
} else {
var template = new Array();
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertWordContent(value);
return true;
case "mceSelectAll":
tinyMCE.execInstanceCommand(editor_id, 'selectall');
return true;
}
// Pass to next handler in chain
return false;
},
// Private plugin internal methods
_handlePasteEvent : function(e) {
switch (e.type) {
case "paste":
var html = TinyMCE_PastePlugin._clipboardHTML();
var r, inst = tinyMCE.selectedInstance;
// Removes italic, strong etc, the if was needed due to bug #1437114
if (inst && (r = inst.getRng()) && r.text.length > 0)
tinyMCE.execCommand('delete');
if (html && html.length > 0)
tinyMCE.execCommand('mcePasteWord', false, html);
tinyMCE.cancelEvent(e);
return false;
}
return true;
},
_insertText : function(content, bLinebreaks) {
if (content && content.length > 0) {
if (bLinebreaks) {
// Special paragraph treatment
if (tinyMCE.getParam("paste_create_paragraphs", true)) {
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
// Has paragraphs
if ((pos = content.indexOf('</p><p>')) != -1) {
tinyMCE.execCommand("Delete");
var node = tinyMCE.selectedInstance.getFocusElement();
// Get list of elements to break
var breakElms = new Array();
do {
if (node.nodeType == 1) {
// Don't break tables and break at body
if (node.nodeName == "TD" || node.nodeName == "BODY")
break;
breakElms[breakElms.length] = node;
}
} while(node = node.parentNode);
var before = "", after = "</p>";
before += content.substring(0, pos);
for (var i=0; i<breakElms.length; i++) {
before += "</" + breakElms[i].nodeName + ">";
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
}
before += "<p>";
content = before + content.substring(pos+7) + after;
}
}
if (tinyMCE.getParam("paste_create_linebreaks", true)) {
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
}
}
tinyMCE.execCommand("mceInsertRawHTML", false, content);
}
},
_insertWordContent : function(content) {
if (content && content.length > 0) {
// Cleanup Word content
var bull = String.fromCharCode(8226);
var middot = String.fromCharCode(183);
var cb;
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('before', content)");
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
}
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
content = content.replace(/<o:p><\/o:p>/gi, "");
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
if (tinyMCE.getParam("paste_remove_spans", true))
content = content.replace(/<\/?span[^>]*>/gi, "");
if (tinyMCE.getParam("paste_remove_styles", true))
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
content = content.replace(/<\/?font[^>]*>/gi, "");
// Strips class attributes.
switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
case "all":
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
break;
case "mso":
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
break;
}
content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
// content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
// content = content.replace(/<p>&nbsp;<\/p>/gi, '');
if (!tinyMCE.settings['force_p_newlines']) {
content = content.replace('', '' ,'gi');
content = content.replace('</p>', '<br /><br />' ,'gi');
}
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
content = content.replace(/<\/?p[^>]*>/gi, "");
}
content = content.replace(/<\/?div[^>]*>/gi, "");
// Convert all middlot lists to UL lists
if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
var div = document.createElement("div");
div.innerHTML = content;
// Convert all middot paragraphs to li elements
var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
content = div.innerHTML;
}
// Replace all headers with strong and fix some other issues
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
content = content.replace(/<h[1-6]>/gi, '<p><b>');
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
content = content.replace(/^(&nbsp;)*/gi, '');
}
content = content.replace(/--list--/gi, ""); // Remove --list--
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('after', content)");
// Insert cleaned content
tinyMCE.execCommand("mceInsertContent", false, content);
if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
}
},
_reEscape : function(s) {
var l = "?.\\*[](){}+^$:";
var o = "";
for (var i=0; i<s.length; i++) {
var c = s.charAt(i);
if (l.indexOf(c) != -1)
o += '\\' + c;
else
o += c;
}
return o;
},
_convertMiddots : function(div, search, class_name) {
var mdot = String.fromCharCode(183);
var bull = String.fromCharCode(8226);
var nodes = div.getElementsByTagName("p");
var prevul;
for (var i=0; i<nodes.length; i++) {
var p = nodes[i];
// Is middot
if (p.innerHTML.indexOf(search) == 0) {
var ul = document.createElement("ul");
if (class_name)
ul.className = class_name;
// Add the first one
var li = document.createElement("li");
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
ul.appendChild(li);
// Add the rest
var np = p.nextSibling;
while (np) {
// If the node is whitespace, then
// ignore it and continue on.
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
np = np.nextSibling;
continue;
}
if (search == mdot) {
if (np.nodeType == 1 && new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)) {
// Second level of nesting
if (!prevul) {
prevul = ul;
ul = document.createElement("ul");
prevul.appendChild(ul);
}
np.innerHTML = np.innerHTML.replace(/^o/, '');
} else {
// Pop the stack if we're going back up to the first level
if (prevul) {
ul = prevul;
prevul = null;
}
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
} else {
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
var cp = np.nextSibling;
var li = document.createElement("li");
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
np.parentNode.removeChild(np);
ul.appendChild(li);
np = cp;
}
p.parentNode.replaceChild(ul, p);
return true;
}
}
return false;
},
_clipboardHTML : function() {
var div = document.getElementById('_TinyMCE_clipboardHTML');
if (!div) {
var div = document.createElement('DIV');
div.id = '_TinyMCE_clipboardHTML';
with (div.style) {
visibility = 'hidden';
overflow = 'hidden';
position = 'absolute';
width = 1;
height = 1;
}
document.body.appendChild(div);
}
div.innerHTML = '';
var rng = document.body.createTextRange();
rng.moveToElementText(div);
rng.execCommand('Paste');
var html = div.innerHTML;
div.innerHTML = '';
return html;
}
};
tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('paste');
var TinyMCE_PastePlugin = {
getInfo : function() {
return {
longname : 'Paste text/word',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
},
getControlHTML : function(cn) {
switch (cn) {
case "pastetext":
return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
case "pasteword":
return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
case "selectall":
return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
}
return '';
},
execCommand : function(editor_id, element, command, user_interface, value) {
switch (command) {
case "mcePasteText":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
else {
var template = new Array();
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
return true;
case "mcePasteWord":
if (user_interface) {
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
} else {
var template = new Array();
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
template['width'] = 450;
template['height'] = 400;
var plain_text = "";
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
}
} else
TinyMCE_PastePlugin._insertWordContent(value);
return true;
case "mceSelectAll":
tinyMCE.execInstanceCommand(editor_id, 'selectall');
return true;
}
// Pass to next handler in chain
return false;
},
// Private plugin internal methods
_handlePasteEvent : function(e) {
switch (e.type) {
case "paste":
var html = TinyMCE_PastePlugin._clipboardHTML();
var r, inst = tinyMCE.selectedInstance;
// Removes italic, strong etc, the if was needed due to bug #1437114
if (inst && (r = inst.getRng()) && r.text.length > 0)
tinyMCE.execCommand('delete');
if (html && html.length > 0)
tinyMCE.execCommand('mcePasteWord', false, html);
tinyMCE.cancelEvent(e);
return false;
}
return true;
},
_insertText : function(content, bLinebreaks) {
if (content && content.length > 0) {
if (bLinebreaks) {
// Special paragraph treatment
if (tinyMCE.getParam("paste_create_paragraphs", true)) {
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
// Has paragraphs
if ((pos = content.indexOf('</p><p>')) != -1) {
tinyMCE.execCommand("Delete");
var node = tinyMCE.selectedInstance.getFocusElement();
// Get list of elements to break
var breakElms = new Array();
do {
if (node.nodeType == 1) {
// Don't break tables and break at body
if (node.nodeName == "TD" || node.nodeName == "BODY")
break;
breakElms[breakElms.length] = node;
}
} while(node = node.parentNode);
var before = "", after = "</p>";
before += content.substring(0, pos);
for (var i=0; i<breakElms.length; i++) {
before += "</" + breakElms[i].nodeName + ">";
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
}
before += "<p>";
content = before + content.substring(pos+7) + after;
}
}
if (tinyMCE.getParam("paste_create_linebreaks", true)) {
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
}
}
tinyMCE.execCommand("mceInsertRawHTML", false, content);
}
},
_insertWordContent : function(content) {
if (content && content.length > 0) {
// Cleanup Word content
var bull = String.fromCharCode(8226);
var middot = String.fromCharCode(183);
var cb;
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('before', content)");
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
for (var i=0; i<rl.length; i+=2)
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
}
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
content = content.replace(/<o:p><\/o:p>/gi, "");
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
if (tinyMCE.getParam("paste_remove_spans", true))
content = content.replace(/<\/?span[^>]*>/gi, "");
if (tinyMCE.getParam("paste_remove_styles", true))
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
content = content.replace(/<\/?font[^>]*>/gi, "");
// Strips class attributes.
switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
case "all":
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
break;
case "mso":
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
break;
}
content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
// content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
// content = content.replace(/<p>&nbsp;<\/p>/gi, '');
if (!tinyMCE.settings['force_p_newlines']) {
content = content.replace('', '' ,'gi');
content = content.replace('</p>', '<br /><br />' ,'gi');
}
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
content = content.replace(/<\/?p[^>]*>/gi, "");
}
content = content.replace(/<\/?div[^>]*>/gi, "");
// Convert all middlot lists to UL lists
if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
var div = document.createElement("div");
div.innerHTML = content;
// Convert all middot paragraphs to li elements
var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
content = div.innerHTML;
}
// Replace all headers with strong and fix some other issues
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
content = content.replace(/<h[1-6]>/gi, '<p><b>');
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
content = content.replace(/^(&nbsp;)*/gi, '');
}
content = content.replace(/--list--/gi, ""); // Remove --list--
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
content = eval(cb + "('after', content)");
// Insert cleaned content
tinyMCE.execCommand("mceInsertContent", false, content);
if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
}
},
_reEscape : function(s) {
var l = "?.\\*[](){}+^$:";
var o = "";
for (var i=0; i<s.length; i++) {
var c = s.charAt(i);
if (l.indexOf(c) != -1)
o += '\\' + c;
else
o += c;
}
return o;
},
_convertMiddots : function(div, search, class_name) {
var mdot = String.fromCharCode(183);
var bull = String.fromCharCode(8226);
var nodes = div.getElementsByTagName("p");
var prevul;
for (var i=0; i<nodes.length; i++) {
var p = nodes[i];
// Is middot
if (p.innerHTML.indexOf(search) == 0) {
var ul = document.createElement("ul");
if (class_name)
ul.className = class_name;
// Add the first one
var li = document.createElement("li");
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
ul.appendChild(li);
// Add the rest
var np = p.nextSibling;
while (np) {
// If the node is whitespace, then
// ignore it and continue on.
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
np = np.nextSibling;
continue;
}
if (search == mdot) {
if (np.nodeType == 1 && new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)) {
// Second level of nesting
if (!prevul) {
prevul = ul;
ul = document.createElement("ul");
prevul.appendChild(ul);
}
np.innerHTML = np.innerHTML.replace(/^o/, '');
} else {
// Pop the stack if we're going back up to the first level
if (prevul) {
ul = prevul;
prevul = null;
}
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
} else {
// Not element or middot paragraph
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
break;
}
var cp = np.nextSibling;
var li = document.createElement("li");
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
np.parentNode.removeChild(np);
ul.appendChild(li);
np = cp;
}
p.parentNode.replaceChild(ul, p);
return true;
}
}
return false;
},
_clipboardHTML : function() {
var div = document.getElementById('_TinyMCE_clipboardHTML');
if (!div) {
var div = document.createElement('DIV');
div.id = '_TinyMCE_clipboardHTML';
with (div.style) {
visibility = 'hidden';
overflow = 'hidden';
position = 'absolute';
width = 1;
height = 1;
}
document.body.appendChild(div);
}
div.innerHTML = '';
var rng = document.body.createTextRange();
rng.moveToElementText(div);
rng.execCommand('Paste');
var html = div.innerHTML;
div.innerHTML = '';
return html;
}
};
tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);

View File

@ -1,38 +1,38 @@
function saveContent() {
if (document.forms[0].htmlSource.value == '') {
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteText', false, {
html : document.forms[0].htmlSource.value,
linebreaks : document.forms[0].linebreaks.checked
});
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Remove Gecko spellchecking
if (tinyMCE.isGecko)
document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
resizeInputs();
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-17;
} else {
wHeight = document.body.clientHeight-80;
wWidth = document.body.clientWidth-17;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}
function saveContent() {
if (document.forms[0].htmlSource.value == '') {
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteText', false, {
html : document.forms[0].htmlSource.value,
linebreaks : document.forms[0].linebreaks.checked
});
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Remove Gecko spellchecking
if (tinyMCE.isGecko)
document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
resizeInputs();
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-17;
} else {
wHeight = document.body.clientHeight-80;
wWidth = document.body.clientWidth-17;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}

View File

@ -1,52 +1,52 @@
function saveContent() {
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
if (html == ''){
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteWord', false, html);
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Fix for endless reloading in FF
window.setTimeout('createIFrame();', 10);
}
function createIFrame() {
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function initIframe(doc) {
var dir = tinyMCE.selectedInstance.settings['directionality'];
doc.body.dir = dir;
// Remove Gecko spellchecking
if (tinyMCE.isGecko)
doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
resizeInputs();
}
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight - 80;
wWidth = self.innerWidth - 18;
} else {
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 18;
}
var elm = document.getElementById('frmData');
if (elm) {
elm.style.height = Math.abs(wHeight) + 'px';
elm.style.width = Math.abs(wWidth) + 'px';
}
}
function saveContent() {
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
if (html == ''){
tinyMCEPopup.close();
return false;
}
tinyMCEPopup.execCommand('mcePasteWord', false, html);
tinyMCEPopup.close();
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
// Fix for endless reloading in FF
window.setTimeout('createIFrame();', 10);
}
function createIFrame() {
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function initIframe(doc) {
var dir = tinyMCE.selectedInstance.settings['directionality'];
doc.body.dir = dir;
// Remove Gecko spellchecking
if (tinyMCE.isGecko)
doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
resizeInputs();
}
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight - 80;
wWidth = self.innerWidth - 18;
} else {
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 18;
}
var elm = document.getElementById('frmData');
if (elm) {
elm.style.height = Math.abs(wHeight) + 'px';
elm.style.width = Math.abs(wWidth) + 'px';
}
}

View File

@ -1,10 +1,10 @@
// UK lang variables
tinyMCE.addToLang('',{
paste_text_desc : 'Paste as Plain Text',
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
paste_text_linebreaks : 'Keep linebreaks',
paste_word_desc : 'Paste from Word',
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
selectall_desc : 'Select All'
});
// UK lang variables
tinyMCE.addToLang('',{
paste_text_desc : 'Paste as Plain Text',
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
paste_text_linebreaks : 'Keep linebreaks',
paste_word_desc : 'Paste from Word',
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
selectall_desc : 'Select All'
});

View File

@ -1,73 +1,73 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*/
require_once("HttpClient.class.php");
class TinyGoogleSpell {
var $lang;
function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
}
// Returns array with bad words or false if failed.
function checkWords($word_array) {
$words = array();
$wordstr = implode(' ', $word_array);
$matches = $this->_getMatches($wordstr);
for ($i=0; $i<count($matches); $i++)
$words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
return $words;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
$sug = array();
$matches = $this->_getMatches($word);
if (count($matches) > 0)
$sug = explode("\t", $matches[0][4]);
return $sug;
}
function _getMatches($word_list) {
$xml = "";
// Setup HTTP Client
$client = new HttpClient('www.google.com');
$client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
$client->setHandleRedirects(false);
$client->setDebug(false);
// Setup XML request
$xml .= '<?xml version="1.0" encoding="utf-8" ?>';
$xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
$xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
// Execute HTTP Post to Google
if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
$this->errorMsg[] = 'An error occurred: ' . $client->getError();
return array();
}
// Grab and parse content
$xml = $client->getContent();
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
return $matches;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyGoogleSpell";
?>
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*/
require_once("HttpClient.class.php");
class TinyGoogleSpell {
var $lang;
function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
}
// Returns array with bad words or false if failed.
function checkWords($word_array) {
$words = array();
$wordstr = implode(' ', $word_array);
$matches = $this->_getMatches($wordstr);
for ($i=0; $i<count($matches); $i++)
$words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
return $words;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
$sug = array();
$matches = $this->_getMatches($word);
if (count($matches) > 0)
$sug = explode("\t", $matches[0][4]);
return $sug;
}
function _getMatches($word_list) {
$xml = "";
// Setup HTTP Client
$client = new HttpClient('www.google.com');
$client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
$client->setHandleRedirects(false);
$client->setDebug(false);
// Setup XML request
$xml .= '<?xml version="1.0" encoding="utf-8" ?>';
$xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
$xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
// Execute HTTP Post to Google
if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
$this->errorMsg[] = 'An error occurred: ' . $client->getError();
return array();
}
// Grab and parse content
$xml = $client->getContent();
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
return $matches;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyGoogleSpell";
?>

View File

@ -1,64 +1,64 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPSpell {
var $lang;
var $mode;
var $string;
var $plink;
var $errorMsg;
var $jargon;
var $spelling;
var $encoding;
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->plink = false;
$this->errorMsg = array();
if (!function_exists("pspell_new")) {
$this->errorMsg[] = "PSpell not found.";
return;
}
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for checkWords.";
return array();
}
$wordError = array();
foreach($wordArray as $word) {
if(!pspell_check($this->plink, trim($word)))
$wordError[] = $word;
}
return $wordError;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
return array();
}
return pspell_suggest($this->plink, $word);
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspell";
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPSpell {
var $lang;
var $mode;
var $string;
var $plink;
var $errorMsg;
var $jargon;
var $spelling;
var $encoding;
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->plink = false;
$this->errorMsg = array();
if (!function_exists("pspell_new")) {
$this->errorMsg[] = "PSpell not found.";
return;
}
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for checkWords.";
return array();
}
$wordError = array();
foreach($wordArray as $word) {
if(!pspell_check($this->plink, trim($word)))
$wordError[] = $word;
}
return $wordError;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if (!$this->plink) {
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
return array();
}
return pspell_suggest($this->plink, $word);
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspell";
?>

View File

@ -1,102 +1,102 @@
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPspellShell {
var $lang;
var $mode;
var $string;
var $error;
var $errorMsg;
var $cmd;
var $tmpfile;
var $jargon;
var $spelling;
var $encoding;
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->error = false;
$this->errorMsg = array();
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
foreach($wordArray as $key => $value)
fwrite($fh, "^" . $value . "\n");
fclose($fh);
} else {
$this->errorMsg[] = "PSpell not found.";
return array();
}
$data = shell_exec($this->cmd);
@unlink($this->tmpfile);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
if (!empty($matches[1]))
$returnData[] = $matches[1];
}
return $returnData;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
fwrite($fh, "^$word\n");
fclose($fh);
} else
wp_die("Error opening tmp file.");
$data = shell_exec($this->cmd);
@unlink($this->tmpfile);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
if (!empty($matches[1])) {
// For some reason, the exec version seems to add commas?
$returnData[] = str_replace(",", "", $matches[1]);
}
}
return $returnData;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspellShell";
?>
<?php
/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*
*/
class TinyPspellShell {
var $lang;
var $mode;
var $string;
var $error;
var $errorMsg;
var $cmd;
var $tmpfile;
var $jargon;
var $spelling;
var $encoding;
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
$this->lang = $lang;
$this->mode = $mode;
$this->error = false;
$this->errorMsg = array();
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
}
// Returns array with bad words or false if failed.
function checkWords($wordArray) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
foreach($wordArray as $key => $value)
fwrite($fh, "^" . $value . "\n");
fclose($fh);
} else {
$this->errorMsg[] = "PSpell not found.";
return array();
}
$data = shell_exec($this->cmd);
@unlink($this->tmpfile);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
if (!empty($matches[1]))
$returnData[] = $matches[1];
}
return $returnData;
}
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
fwrite($fh, "^$word\n");
fclose($fh);
} else
wp_die("Error opening tmp file.");
$data = shell_exec($this->cmd);
@unlink($this->tmpfile);
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
foreach($dataArr as $dstr) {
$matches = array();
// Skip this line.
if (strpos($dstr, "@") === 0)
continue;
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
if (!empty($matches[1])) {
// For some reason, the exec version seems to add commas?
$returnData[] = str_replace(",", "", $matches[1]);
}
}
return $returnData;
}
}
// Setup classname, should be the same as the name of the spellchecker class
$spellCheckerConfig['class'] = "TinyPspellShell";
?>

View File

@ -1,29 +1,29 @@
<?php
$spellCheckerConfig = array();
// General settings
$spellCheckerConfig['enabled'] = true;
// Pspell shell specific settings
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp/tinyspell/0';
// Default settings
$spellCheckerConfig['default.language'] = 'en';
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
// Normaly not required to configure
$spellCheckerConfig['default.spelling'] = "";
$spellCheckerConfig['default.jargon'] = "";
$spellCheckerConfig['default.encoding'] = "";
// Spellchecker class use
if ( function_exists('pspell_new') )
require_once("classes/TinyPspell.class.php"); // Internal PHP version
elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
require_once("classes/TinyPspellShell.class.php"); // Command line pspell
else
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
?>
<?php
$spellCheckerConfig = array();
// General settings
$spellCheckerConfig['enabled'] = true;
// Pspell shell specific settings
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp/tinyspell/0';
// Default settings
$spellCheckerConfig['default.language'] = 'en';
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
// Normaly not required to configure
$spellCheckerConfig['default.spelling'] = "";
$spellCheckerConfig['default.jargon'] = "";
$spellCheckerConfig['default.encoding'] = "";
// Spellchecker class use
if ( function_exists('pspell_new') )
require_once("classes/TinyPspell.class.php"); // Internal PHP version
elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
require_once("classes/TinyPspellShell.class.php"); // Command line pspell
else
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
// UK lang variables
tinyMCE.addToLang('spellchecker',{
desc : 'Toggle spellchecker',
menu : 'Spellchecker settings',
ignore_word : 'Ignore word',
ignore_words : 'Ignore all',
langs : 'Languages',
wait : 'Please wait...',
swait : 'Spellchecking, please wait...',
sug : 'Suggestions',
no_sug : 'No suggestions',
no_mpell : 'No misspellings found.'
});
// UK lang variables
tinyMCE.addToLang('spellchecker',{
desc : 'Toggle spellchecker',
menu : 'Spellchecker settings',
ignore_word : 'Ignore word',
ignore_words : 'Ignore all',
langs : 'Languages',
wait : 'Please wait...',
swait : 'Spellchecking, please wait...',
sug : 'Suggestions',
no_sug : 'No suggestions',
no_mpell : 'No misspellings found.'
});

View File

@ -1,133 +1,133 @@
<?php
/**
* $RCSfile: tinyspell.php,v $
* $Revision: 1.1 $
* $Date: 2006/03/14 17:33:47 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
require_once("config.php");
$id = sanitize($_POST['id'], "loose");
if (!$spellCheckerConfig['enabled']) {
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
die;
}
// Basic config
$defaultLanguage = $spellCheckerConfig['default.language'];
$defaultMode = $spellCheckerConfig['default.mode'];
// Normaly not required to configure
$defaultSpelling = $spellCheckerConfig['default.spelling'];
$defaultJargon = $spellCheckerConfig['default.jargon'];
$defaultEncoding = $spellCheckerConfig['default.encoding'];
$outputType = "xml"; // Do not change
// Get input parameters.
$check = $_POST['check'];
$cmd = sanitize($_POST['cmd']);
$lang = sanitize($_POST['lang'], "strict");
$mode = sanitize($_POST['mode'], "strict");
$spelling = sanitize($_POST['spelling'], "strict");
$jargon = sanitize($_POST['jargon'], "strict");
$encoding = sanitize($_POST['encoding'], "strict");
$sg = sanitize($_POST['sg'], "bool");
$words = array();
$validRequest = true;
if (empty($check))
$validRequest = false;
if (empty($lang))
$lang = $defaultLanguage;
if (empty($mode))
$mode = $defaultMode;
if (empty($spelling))
$spelling = $defaultSpelling;
if (empty($jargon))
$jargon = $defaultJargon;
if (empty($encoding))
$encoding = $defaultEncoding;
function sanitize($str, $type="strict") {
switch ($type) {
case "strict":
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
break;
case "loose":
$str = preg_replace("/</i", "&gt;", $str);
$str = preg_replace("/>/i", "&lt;", $str);
break;
case "bool":
if ($str == "true" || $str == true)
$str = true;
else
$str = false;
break;
}
return $str;
}
$result = array();
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
if (count($tinyspell->errorMsg) == 0) {
switch($cmd) {
case "spell":
// Space for non-exec version and \n for the exec version.
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
$result = $tinyspell->checkWords($words);
break;
case "suggest":
$result = $tinyspell->getSuggestion($check);
break;
default:
// Just use this for now.
$tinyspell->errorMsg[] = "No command.";
$outputType = $outputType . "error";
break;
}
} else
$outputType = $outputType . "error";
if (!$result)
$result = array();
// Output data
switch($outputType) {
case "xml":
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
if (count($result) == 0)
echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
else
echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
break;
case "xmlerror";
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
break;
case "html":
var_dump($result);
break;
case "htmlerror":
echo "Error";
break;
}
?>
<?php
/**
* $RCSfile: tinyspell.php,v $
* $Revision: 1.1 $
* $Date: 2006/03/14 17:33:47 $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
require_once("config.php");
$id = sanitize($_POST['id'], "loose");
if (!$spellCheckerConfig['enabled']) {
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
die;
}
// Basic config
$defaultLanguage = $spellCheckerConfig['default.language'];
$defaultMode = $spellCheckerConfig['default.mode'];
// Normaly not required to configure
$defaultSpelling = $spellCheckerConfig['default.spelling'];
$defaultJargon = $spellCheckerConfig['default.jargon'];
$defaultEncoding = $spellCheckerConfig['default.encoding'];
$outputType = "xml"; // Do not change
// Get input parameters.
$check = $_POST['check'];
$cmd = sanitize($_POST['cmd']);
$lang = sanitize($_POST['lang'], "strict");
$mode = sanitize($_POST['mode'], "strict");
$spelling = sanitize($_POST['spelling'], "strict");
$jargon = sanitize($_POST['jargon'], "strict");
$encoding = sanitize($_POST['encoding'], "strict");
$sg = sanitize($_POST['sg'], "bool");
$words = array();
$validRequest = true;
if (empty($check))
$validRequest = false;
if (empty($lang))
$lang = $defaultLanguage;
if (empty($mode))
$mode = $defaultMode;
if (empty($spelling))
$spelling = $defaultSpelling;
if (empty($jargon))
$jargon = $defaultJargon;
if (empty($encoding))
$encoding = $defaultEncoding;
function sanitize($str, $type="strict") {
switch ($type) {
case "strict":
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
break;
case "loose":
$str = preg_replace("/</i", "&gt;", $str);
$str = preg_replace("/>/i", "&lt;", $str);
break;
case "bool":
if ($str == "true" || $str == true)
$str = true;
else
$str = false;
break;
}
return $str;
}
$result = array();
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
if (count($tinyspell->errorMsg) == 0) {
switch($cmd) {
case "spell":
// Space for non-exec version and \n for the exec version.
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
$result = $tinyspell->checkWords($words);
break;
case "suggest":
$result = $tinyspell->getSuggestion($check);
break;
default:
// Just use this for now.
$tinyspell->errorMsg[] = "No command.";
$outputType = $outputType . "error";
break;
}
} else
$outputType = $outputType . "error";
if (!$result)
$result = array();
// Output data
switch($outputType) {
case "xml":
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
if (count($result) == 0)
echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
else
echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
break;
case "xmlerror";
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
break;
case "html":
var_dump($result);
break;
case "htmlerror":
echo "Error";
break;
}
?>

View File

@ -1,33 +1,33 @@
// EN lang variables
if (navigator.userAgent.indexOf('Mac OS') != -1) {
// Mac OS browsers use Ctrl to hit accesskeys
var metaKey = 'Ctrl';
}
else {
var metaKey = 'Alt';
}
tinyMCE.addToLang('',{
wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
wordpress_page_button : 'Split post with Page tag',
wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
wordpress_more_alt : 'More...',
wordpress_page_alt : '...page...',
help_button_title : 'Help (' + metaKey + '+h)',
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
link_desc : 'Insert/edit link (' + metaKey + '+a)',
unlink_desc : 'Unlink (' + metaKey + '+s)',
image_desc : 'Insert/edit image (' + metaKey + '+m)',
striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
justifyleft_desc : 'Align left (' + metaKey + '+f)',
justifycenter_desc : 'Align center (' + metaKey + '+c)',
justifyright_desc : 'Align right (' + metaKey + '+r)',
justifyfull_desc : 'Align full (' + metaKey + '+j)',
bullist_desc : 'Unordered list (' + metaKey + '+l)',
numlist_desc : 'Ordered list (' + metaKey + '+o)',
outdent_desc : 'Outdent (' + metaKey + '+w)',
indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
});
// EN lang variables
if (navigator.userAgent.indexOf('Mac OS') != -1) {
// Mac OS browsers use Ctrl to hit accesskeys
var metaKey = 'Ctrl';
}
else {
var metaKey = 'Alt';
}
tinyMCE.addToLang('',{
wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
wordpress_page_button : 'Split post with Page tag',
wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
wordpress_more_alt : 'More...',
wordpress_page_alt : '...page...',
help_button_title : 'Help (' + metaKey + '+h)',
bold_desc : 'Bold (Ctrl+B)',
italic_desc : 'Italic (Ctrl+I)',
underline_desc : 'Underline (Ctrl+U)',
link_desc : 'Insert/edit link (' + metaKey + '+a)',
unlink_desc : 'Unlink (' + metaKey + '+s)',
image_desc : 'Insert/edit image (' + metaKey + '+m)',
striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
justifyleft_desc : 'Align left (' + metaKey + '+f)',
justifycenter_desc : 'Align center (' + metaKey + '+c)',
justifyright_desc : 'Align right (' + metaKey + '+r)',
justifyfull_desc : 'Align full (' + metaKey + '+j)',
bullist_desc : 'Unordered list (' + metaKey + '+l)',
numlist_desc : 'Ordered list (' + metaKey + '+o)',
outdent_desc : 'Outdent (' + metaKey + '+w)',
indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
});

View File

@ -1,57 +1,57 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('wphelp', '');
function TinyMCE_wphelp_getControlHTML(control_name) {
switch (control_name) {
case "wphelp":
var titleHelp = tinyMCE.getLang('lang_help_button_title');
var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
var hiddenControls = '<div class="zerosize">'
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
+ '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
+ '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
+ '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
+ '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
+ '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
+ '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
+ '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
+ '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
+ '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
+ '</div>';
return buttons+hiddenControls;
}
return "";
}
function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceWordPressHelp":
var template = new Array();
template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
template['width'] = 480;
template['height'] = 380;
args = {
resizable : 'yes',
scrollbars : 'yes'
};
tinyMCE.openWindow(template, args);
return true;
}
// Pass to next handler in chain
return false;
}
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('wphelp', '');
function TinyMCE_wphelp_getControlHTML(control_name) {
switch (control_name) {
case "wphelp":
var titleHelp = tinyMCE.getLang('lang_help_button_title');
var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
var hiddenControls = '<div class="zerosize">'
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
+ '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
+ '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
+ '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
+ '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
+ '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
+ '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
+ '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
+ '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
+ '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
+ '</div>';
return buttons+hiddenControls;
}
return "";
}
function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceWordPressHelp":
var template = new Array();
template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
template['width'] = 480;
template['height'] = 380;
args = {
resizable : 'yes',
scrollbars : 'yes'
};
tinyMCE.openWindow(template, args);
return true;
}
// Pass to next handler in chain
return false;
}

View File

@ -1,5 +1,5 @@
// EN lang variables
tinyMCE.addToLang('',{
help_button_title : 'Help (Alt+h)'
});
// EN lang variables
tinyMCE.addToLang('',{
help_button_title : 'Help (Alt+h)'
});

View File

@ -1,82 +1,82 @@
// UK lang variables
tinyMCE.addToLang('',{
theme_style_select : '-- Styles --',
theme_code_desc : 'Edit HTML Source',
theme_code_title : 'HTML Source Editor',
theme_code_wordwrap : 'Word wrap',
theme_sub_desc : 'Subscript',
theme_sup_desc : 'Superscript',
theme_hr_desc : 'Insert horizontal ruler',
theme_removeformat_desc : 'Remove formatting',
theme_custom1_desc : 'Your custom description here',
insert_image_border : 'Border',
insert_image_dimensions : 'Dimensions',
insert_image_vspace : 'Vertical space',
insert_image_hspace : 'Horizontal space',
insert_image_align : 'Alignment',
insert_image_align_default : '-- Not set --',
insert_image_align_baseline : 'Baseline',
insert_image_align_top : 'Top',
insert_image_align_middle : 'Middle',
insert_image_align_bottom : 'Bottom',
insert_image_align_texttop : 'TextTop',
insert_image_align_absmiddle : 'Absolute Middle',
insert_image_align_absbottom : 'Absolute Bottom',
insert_image_align_left : 'Left',
insert_image_align_right : 'Right',
theme_font_size : '-- Font size --',
theme_fontdefault : '-- Font family --',
theme_block : '-- Format --',
theme_paragraph : 'Paragraph',
theme_div : 'Div',
theme_address : 'Address',
theme_pre : 'Preformatted',
theme_h1 : 'Heading 1',
theme_h2 : 'Heading 2',
theme_h3 : 'Heading 3',
theme_h4 : 'Heading 4',
theme_h5 : 'Heading 5',
theme_h6 : 'Heading 6',
theme_blockquote : 'Blockquote',
theme_code : 'Code',
theme_samp : 'Code sample',
theme_dt : 'Definition term ',
theme_dd : 'Definition description',
theme_colorpicker_title : 'Select a color',
theme_colorpicker_apply : 'Apply',
theme_forecolor_desc : 'Select text color',
theme_backcolor_desc : 'Select background color',
theme_charmap_title : 'Select custom character',
theme_charmap_desc : 'Insert custom character',
theme_visualaid_desc : 'Toggle guidelines/invisible elements',
insert_anchor_title : 'Insert/edit anchor',
insert_anchor_name : 'Anchor name',
theme_anchor_desc : 'Insert/edit anchor',
theme_insert_link_titlefield : 'Title',
theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
theme_path : 'Path',
cut_desc : 'Cut',
copy_desc : 'Copy',
paste_desc : 'Paste',
link_list : 'Link list',
image_list : 'Image list',
browse : 'Browse',
image_props_desc : 'Image properties',
newdocument_desc : 'New document',
class_name : 'Class',
newdocument : 'Are you sure you want clear all contents?',
about_title : 'About TinyMCE',
about : 'About',
license : 'License',
plugins : 'Plugins',
plugin : 'Plugin',
author : 'Author',
version : 'Version',
loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
close : 'Close',
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
invalid_data : 'Error: Invalid values entered, these are marked in red.'
});
// UK lang variables
tinyMCE.addToLang('',{
theme_style_select : '-- Styles --',
theme_code_desc : 'Edit HTML Source',
theme_code_title : 'HTML Source Editor',
theme_code_wordwrap : 'Word wrap',
theme_sub_desc : 'Subscript',
theme_sup_desc : 'Superscript',
theme_hr_desc : 'Insert horizontal ruler',
theme_removeformat_desc : 'Remove formatting',
theme_custom1_desc : 'Your custom description here',
insert_image_border : 'Border',
insert_image_dimensions : 'Dimensions',
insert_image_vspace : 'Vertical space',
insert_image_hspace : 'Horizontal space',
insert_image_align : 'Alignment',
insert_image_align_default : '-- Not set --',
insert_image_align_baseline : 'Baseline',
insert_image_align_top : 'Top',
insert_image_align_middle : 'Middle',
insert_image_align_bottom : 'Bottom',
insert_image_align_texttop : 'TextTop',
insert_image_align_absmiddle : 'Absolute Middle',
insert_image_align_absbottom : 'Absolute Bottom',
insert_image_align_left : 'Left',
insert_image_align_right : 'Right',
theme_font_size : '-- Font size --',
theme_fontdefault : '-- Font family --',
theme_block : '-- Format --',
theme_paragraph : 'Paragraph',
theme_div : 'Div',
theme_address : 'Address',
theme_pre : 'Preformatted',
theme_h1 : 'Heading 1',
theme_h2 : 'Heading 2',
theme_h3 : 'Heading 3',
theme_h4 : 'Heading 4',
theme_h5 : 'Heading 5',
theme_h6 : 'Heading 6',
theme_blockquote : 'Blockquote',
theme_code : 'Code',
theme_samp : 'Code sample',
theme_dt : 'Definition term ',
theme_dd : 'Definition description',
theme_colorpicker_title : 'Select a color',
theme_colorpicker_apply : 'Apply',
theme_forecolor_desc : 'Select text color',
theme_backcolor_desc : 'Select background color',
theme_charmap_title : 'Select custom character',
theme_charmap_desc : 'Insert custom character',
theme_visualaid_desc : 'Toggle guidelines/invisible elements',
insert_anchor_title : 'Insert/edit anchor',
insert_anchor_name : 'Anchor name',
theme_anchor_desc : 'Insert/edit anchor',
theme_insert_link_titlefield : 'Title',
theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
theme_path : 'Path',
cut_desc : 'Cut',
copy_desc : 'Copy',
paste_desc : 'Paste',
link_list : 'Link list',
image_list : 'Image list',
browse : 'Browse',
image_props_desc : 'Image properties',
newdocument_desc : 'New document',
class_name : 'Class',
newdocument : 'Are you sure you want clear all contents?',
about_title : 'About TinyMCE',
about : 'About',
license : 'License',
plugins : 'Plugins',
plugin : 'Plugin',
author : 'Author',
version : 'Version',
loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
close : 'Close',
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
invalid_data : 'Error: Invalid values entered, these are marked in red.'
});

View File

@ -1,210 +1,210 @@
/**
* $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
*
* Various form utilitiy functions.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
h += ' onmouseover="this.className=\'mceButtonOver\'"';
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
h += ' onmousedown="this.className=\'mceButtonDown\'"';
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return h;
}
function pickColor(e, target_form_element) {
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
tinyMCEPopup.pickColor(e, target_form_element);
}
function updateColor(img_id, form_element_id) {
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
function setBrowserDisabled(id, state) {
var img = document.getElementById(id);
var lnk = document.getElementById(id + "_link");
if (lnk) {
if (state) {
lnk.setAttribute("realhref", lnk.getAttribute("href"));
lnk.removeAttribute("href");
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
} else {
lnk.setAttribute("href", lnk.getAttribute("realhref"));
tinyMCE.switchClass(img, 'mceButtonNormal', false);
}
}
}
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback";
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
if (cb == null)
return "";
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return html;
}
function openBrower(img_id, target_form_element, type, option) {
var img = document.getElementById(img_id);
if (img.className != "mceButtonDisabled")
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
sel.selectedIndex = sel.options.length - 1;
}
return found;
}
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
return "";
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCE.getParam('theme_advanced_styles', false);
styles = tinyMCE.getParam(specific_option, styles);
if (styles) {
var stylesAr = styles.split(';');
for (var i=0; i<stylesAr.length; i++) {
if (stylesAr != "") {
var key, value;
key = stylesAr[i].split('=')[0];
value = stylesAr[i].split('=')[1];
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
}
}
} else {
// Use auto impored classes
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
for (var i=0; i<csses.length; i++)
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
}
}
function isVisible(element_id) {
var elm = document.getElementById(element_id);
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
return size.indexOf('%') != -1 ? size : size + "px";
}
function getStyle(elm, attrib, style) {
var val = tinyMCE.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
val = eval('elm.style.' + style);
return val == null ? '' : '' + val;
}
/**
* $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
*
* Various form utilitiy functions.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
h += ' onmouseover="this.className=\'mceButtonOver\'"';
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
h += ' onmousedown="this.className=\'mceButtonDown\'"';
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return h;
}
function pickColor(e, target_form_element) {
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
tinyMCEPopup.pickColor(e, target_form_element);
}
function updateColor(img_id, form_element_id) {
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
function setBrowserDisabled(id, state) {
var img = document.getElementById(id);
var lnk = document.getElementById(id + "_link");
if (lnk) {
if (state) {
lnk.setAttribute("realhref", lnk.getAttribute("href"));
lnk.removeAttribute("href");
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
} else {
lnk.setAttribute("href", lnk.getAttribute("realhref"));
tinyMCE.switchClass(img, 'mceButtonNormal', false);
}
}
}
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback";
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
if (cb == null)
return "";
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return html;
}
function openBrower(img_id, target_form_element, type, option) {
var img = document.getElementById(img_id);
if (img.className != "mceButtonDisabled")
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
sel.selectedIndex = sel.options.length - 1;
}
return found;
}
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
return "";
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCE.getParam('theme_advanced_styles', false);
styles = tinyMCE.getParam(specific_option, styles);
if (styles) {
var stylesAr = styles.split(';');
for (var i=0; i<stylesAr.length; i++) {
if (stylesAr != "") {
var key, value;
key = stylesAr[i].split('=')[0];
value = stylesAr[i].split('=')[1];
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
}
}
} else {
// Use auto impored classes
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
for (var i=0; i<csses.length; i++)
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
}
}
function isVisible(element_id) {
var elm = document.getElementById(element_id);
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
return size.indexOf('%') != -1 ? size : size + "px";
}
function getStyle(elm, attrib, style) {
var val = tinyMCE.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
val = eval('elm.style.' + style);
return val == null ? '' : '' + val;
}

View File

@ -1,210 +1,210 @@
/**
* $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode floating layer script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCLayer(id) {
this.id = id;
this.settings = new Array();
this.blockerElement = null;
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.events = false;
this.autoHideCallback = null;
}
MCLayer.prototype = {
moveRelativeTo : function(re, p, a) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var x, y;
switch (p) {
case "tl":
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
break;
case "br":
break;
}
this.moveTo(x, y);
},
moveBy : function(dx, dy) {
var e = this.getElement();
var x = parseInt(e.style.left);
var y = parseInt(e.style.top);
e.style.left = (x + dx) + "px";
e.style.top = (y + dy) + "px";
this.updateBlocker();
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
show : function() {
MCLayer.visibleLayer = this;
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
setAutoHide : function(s, cb) {
this.autoHideCallback = cb;
this.registerEventHandlers();
},
getElement : function() {
return document.getElementById(this.id);
},
updateBlocker : function() {
if (!this.isMSIE)
return;
var e = this.getElement();
var b = this.getBlocker();
var x = this.parseInt(e.style.left);
var y = this.parseInt(e.style.top);
var w = this.parseInt(e.offsetWidth);
var h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
},
getBlocker : function() {
if (!this.blockerElement) {
var d = document, b = d.createElement("iframe");
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
registerEventHandlers : function() {
if (!this.events) {
var d = document;
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
this.events = true;
}
},
addEvent : function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
},
onMouseDown : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var b = document.body;
var l = MCLayer.visibleLayer;
if (l) {
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
var el = l.getElement();
var x = parseInt(el.style.left);
var y = parseInt(el.style.top);
var w = parseInt(el.offsetWidth);
var h = parseInt(el.offsetHeight);
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
MCLayer.visibleLayer = null;
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
return true;
l.hide();
}
}
},
addCSSClass : function(e, c) {
this.removeCSSClass(e, c);
var a = this.explode(' ', e.className);
a[a.length] = c;
e.className = a.join(' ');
},
removeCSSClass : function(e, c) {
var a = this.explode(' ', e.className), i;
for (i=0; i<a.length; i++) {
if (a[i] == c)
a[i] = '';
}
e.className = a.join(' ');
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
}
/**
* $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode floating layer script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCLayer(id) {
this.id = id;
this.settings = new Array();
this.blockerElement = null;
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.events = false;
this.autoHideCallback = null;
}
MCLayer.prototype = {
moveRelativeTo : function(re, p, a) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var x, y;
switch (p) {
case "tl":
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
break;
case "br":
break;
}
this.moveTo(x, y);
},
moveBy : function(dx, dy) {
var e = this.getElement();
var x = parseInt(e.style.left);
var y = parseInt(e.style.top);
e.style.left = (x + dx) + "px";
e.style.top = (y + dy) + "px";
this.updateBlocker();
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
show : function() {
MCLayer.visibleLayer = this;
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
setAutoHide : function(s, cb) {
this.autoHideCallback = cb;
this.registerEventHandlers();
},
getElement : function() {
return document.getElementById(this.id);
},
updateBlocker : function() {
if (!this.isMSIE)
return;
var e = this.getElement();
var b = this.getBlocker();
var x = this.parseInt(e.style.left);
var y = this.parseInt(e.style.top);
var w = this.parseInt(e.offsetWidth);
var h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
},
getBlocker : function() {
if (!this.blockerElement) {
var d = document, b = d.createElement("iframe");
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
registerEventHandlers : function() {
if (!this.events) {
var d = document;
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
this.events = true;
}
},
addEvent : function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
},
onMouseDown : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var b = document.body;
var l = MCLayer.visibleLayer;
if (l) {
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
var el = l.getElement();
var x = parseInt(el.style.left);
var y = parseInt(el.style.top);
var w = parseInt(el.offsetWidth);
var h = parseInt(el.offsetHeight);
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
MCLayer.visibleLayer = null;
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
return true;
l.hide();
}
}
},
addCSSClass : function(e, c) {
this.removeCSSClass(e, c);
var a = this.explode(' ', e.className);
a[a.length] = c;
e.className = a.join(' ');
},
removeCSSClass : function(e, c) {
var a = this.explode(' ', e.className), i;
for (i=0; i<a.length; i++) {
if (a[i] == c)
a[i] = '';
}
e.className = a.join(' ');
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
}

View File

@ -1,74 +1,74 @@
/**
* $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCTabs() {
this.settings = new Array();
};
MCTabs.prototype.init = function(settings) {
this.settings = settings;
};
MCTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm = document.getElementById(panel_id);
var panelContainerElm = panelElm ? panelElm.parentNode : null;
var tabElm = document.getElementById(tab_id);
var tabContainerElm = tabElm ? tabElm.parentNode : null;
var selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
var nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
var nodes = panelContainerElm.childNodes;
// Hide all other panels
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
MCTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var mcTabs = new MCTabs();
/**
* $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
function MCTabs() {
this.settings = new Array();
};
MCTabs.prototype.init = function(settings) {
this.settings = settings;
};
MCTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm = document.getElementById(panel_id);
var panelContainerElm = panelElm ? panelElm.parentNode : null;
var tabElm = document.getElementById(tab_id);
var tabContainerElm = tabElm ? tabElm.parentNode : null;
var selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
var nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
var nodes = panelContainerElm.childNodes;
// Hide all other panels
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
MCTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var mcTabs = new MCTabs();

View File

@ -1,219 +1,219 @@
/**
* $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
*
* Various form validation methods.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/**
// String validation:
if (!Validator.isEmail('myemail'))
alert('Invalid email.');
// Form validation:
var f = document.forms['myform'];
if (!Validator.isEmail(f.myemail))
alert('Invalid email.');
*/
var Validator = {
isEmail : function(s) {
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
},
isAbsUrl : function(s) {
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
},
isSize : function(s) {
return this.test(s, '^[0-9]+(px|%)?$');
},
isId : function(s) {
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
},
isEmpty : function(s) {
var nl, i;
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
return true;
if (s.type == 'checkbox' && !s.checked)
return true;
if (s.type == 'radio') {
for (i=0, nl = s.form.elements; i<nl.length; i++) {
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
return false;
}
return true;
}
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
},
isNumber : function(s, d) {
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
},
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
};
var AutoValidator = {
settings : {
id_cls : 'id',
int_cls : 'int',
url_cls : 'url',
number_cls : 'number',
email_cls : 'email',
size_cls : 'size',
required_cls : 'required',
invalid_cls : 'invalid',
min_cls : 'min',
max_cls : 'max'
},
init : function(s) {
var n;
for (n in s)
this.settings[n] = s[n];
},
validate : function(f) {
var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
for (i=0; i<nl.length; i++)
this.removeClass(nl[i], s.invalid_cls);
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
c += this.validateElms(f, 'textarea');
return c == 3;
},
invalidate : function(n) {
this.mark(n.form, n);
},
reset : function(e) {
var t = new Array('label', 'input', 'select', 'textarea');
var i, j, nl, s = this.settings;
if (e == null)
return;
for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
for (j=0; j<nl.length; j++)
this.removeClass(nl[j], s.invalid_cls);
}
},
validateElms : function(f, e) {
var nl, i, n, s = this.settings, st = true, va = Validator, v;
nl = this.tags(f, e);
for (i=0; i<nl.length; i++) {
n = nl[i];
this.removeClass(n, s.invalid_cls);
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
st = this.mark(f, n);
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
st = this.mark(f, n);
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
st = this.mark(f, n);
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
st = this.mark(f, n);
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
st = this.mark(f, n);
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
st = this.mark(f, n);
if (this.hasClass(n, s.id_cls) && !va.isId(n))
st = this.mark(f, n);
if (this.hasClass(n, s.min_cls, true)) {
v = this.getNum(n, s.min_cls);
if (isNaN(v) || parseInt(n.value) < parseInt(v))
st = this.mark(f, n);
}
if (this.hasClass(n, s.max_cls, true)) {
v = this.getNum(n, s.max_cls);
if (isNaN(v) || parseInt(n.value) > parseInt(v))
st = this.mark(f, n);
}
}
return st;
},
hasClass : function(n, c, d) {
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
},
getNum : function(n, c) {
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
c = c.replace(/[^0-9]/g, '');
return c;
},
addClass : function(n, c, b) {
var o = this.removeClass(n, c);
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
},
removeClass : function(n, c) {
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
return n.className = c != ' ' ? c : '';
},
tags : function(f, s) {
return f.getElementsByTagName(s);
},
mark : function(f, n) {
var s = this.settings;
this.addClass(n, s.invalid_cls);
this.markLabels(f, n, s.invalid_cls);
return false;
},
markLabels : function(f, n, ic) {
var nl, i;
nl = this.tags(f, "label");
for (i=0; i<nl.length; i++) {
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
this.addClass(nl[i], ic);
}
return null;
}
};
/**
* $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
*
* Various form validation methods.
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/**
// String validation:
if (!Validator.isEmail('myemail'))
alert('Invalid email.');
// Form validation:
var f = document.forms['myform'];
if (!Validator.isEmail(f.myemail))
alert('Invalid email.');
*/
var Validator = {
isEmail : function(s) {
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
},
isAbsUrl : function(s) {
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
},
isSize : function(s) {
return this.test(s, '^[0-9]+(px|%)?$');
},
isId : function(s) {
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
},
isEmpty : function(s) {
var nl, i;
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
return true;
if (s.type == 'checkbox' && !s.checked)
return true;
if (s.type == 'radio') {
for (i=0, nl = s.form.elements; i<nl.length; i++) {
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
return false;
}
return true;
}
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
},
isNumber : function(s, d) {
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
},
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
};
var AutoValidator = {
settings : {
id_cls : 'id',
int_cls : 'int',
url_cls : 'url',
number_cls : 'number',
email_cls : 'email',
size_cls : 'size',
required_cls : 'required',
invalid_cls : 'invalid',
min_cls : 'min',
max_cls : 'max'
},
init : function(s) {
var n;
for (n in s)
this.settings[n] = s[n];
},
validate : function(f) {
var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
for (i=0; i<nl.length; i++)
this.removeClass(nl[i], s.invalid_cls);
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
c += this.validateElms(f, 'textarea');
return c == 3;
},
invalidate : function(n) {
this.mark(n.form, n);
},
reset : function(e) {
var t = new Array('label', 'input', 'select', 'textarea');
var i, j, nl, s = this.settings;
if (e == null)
return;
for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
for (j=0; j<nl.length; j++)
this.removeClass(nl[j], s.invalid_cls);
}
},
validateElms : function(f, e) {
var nl, i, n, s = this.settings, st = true, va = Validator, v;
nl = this.tags(f, e);
for (i=0; i<nl.length; i++) {
n = nl[i];
this.removeClass(n, s.invalid_cls);
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
st = this.mark(f, n);
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
st = this.mark(f, n);
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
st = this.mark(f, n);
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
st = this.mark(f, n);
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
st = this.mark(f, n);
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
st = this.mark(f, n);
if (this.hasClass(n, s.id_cls) && !va.isId(n))
st = this.mark(f, n);
if (this.hasClass(n, s.min_cls, true)) {
v = this.getNum(n, s.min_cls);
if (isNaN(v) || parseInt(n.value) < parseInt(v))
st = this.mark(f, n);
}
if (this.hasClass(n, s.max_cls, true)) {
v = this.getNum(n, s.max_cls);
if (isNaN(v) || parseInt(n.value) > parseInt(v))
st = this.mark(f, n);
}
}
return st;
},
hasClass : function(n, c, d) {
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
},
getNum : function(n, c) {
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
c = c.replace(/[^0-9]/g, '');
return c;
},
addClass : function(n, c, b) {
var o = this.removeClass(n, c);
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
},
removeClass : function(n, c) {
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
return n.className = c != ' ' ? c : '';
},
tags : function(f, s) {
return f.getElementsByTagName(s);
},
mark : function(f, n) {
var s = this.settings;
this.addClass(n, s.invalid_cls);
this.markLabels(f, n, s.invalid_cls);
return false;
},
markLabels : function(f, n, ic) {
var nl, i;
nl = this.tags(f, "label");
for (i=0; i<nl.length; i++) {
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
this.addClass(nl[i], ic);
}
return null;
}
};