Location: PHPKode > projects > NetLink > netlink_os/egap/text.php
<head>
<title>
WebText&copy; - Rotide Egap
</title>
<style type='text/css'>
.spacer
{
  font-weight: bold;
}
</style>
<script type='text/javascript'>
function change_font()
{
sel_font=document.getElementById("font").value;
document.getElementById("text1").style.fontFamily=sel_font;
current=document.getElementById("text1").style.fontFamily;
//alert("SELECT:"+sel_font+"\nCURRENT:"+current);
}
function create_text()
{
  text=document.getElementById("text1").value;
  win_open=window.opener.document.getElementById("preview").innerHTML;
  
  font=document.getElementById("font").value
  size=document.getElementById("font_size").value
  fcolor=document.getElementById("text1").style.color;
  if (!fcolor)
    fcolor="#000000";
  bcolor=document.getElementById("text1").style.backgroundColor;
  //if (!bcolor)
    //bcolor="#FFFFFF";
  //alert("TEXTBOX OLD:"+text)
  
  x=0;
  for (x==0; x<=text.length; x++)
  {
    text=text.replace("\n","<br/>");
    text=text.replace("      ","<span style='margin-left:30px;'></span>");
    text=text.replace("     ","<span style='margin-left:30px;'></span>");
    text=text.replace("    ","<span style='margin-left:30px;'></span>");
    text=text.replace("   ","<span style='margin-left:30px;'></span>");
  }
  
  //put BR values into textbox  
  document.getElementById("text1").value=text;
  //get BR values out of textbox (required for formatting)
  text=document.getElementById("text1").value;
  
  //alert("TEXTBOX NEW:"+text)
  
  var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
  var randomstring = '';
  for (var k=0; k<=3; k++) {
	var rnum = Math.floor(Math.random() * chars.length);
    randomstring += chars.substring(rnum,rnum+1);
  }
  <?php
  if (!$id)
    include("js.txt");
  else
		{
		echo "window.opener.document.getElementById('$id').innerHTML=text;\n";
		echo 'window.opener.document.getElementById("egap_b_code").value=window.opener.document.getElementById("preview").innerHTML;';
		}
	?>
  window.close();
}

function font_color()
{
  window.open('font_color.php','symbol','width=450,height=400');
}
function bg_color()
{
 window.open('background.php','symbol','width=450,height=400')
}
function formatText(tag)
{
  if (document.getElementById("text1").setSelectionRange) 
  {
    document.getElementById("text1").value = document.getElementById("text1").value.substring(0,document.getElementById("text1").selectionStart) + "<" + tag + ">" + document.getElementById("text1").value.substring(document.getElementById("text1").selectionStart,document.getElementById("text1").selectionEnd) + "</" + tag + ">" + document.getElementById("text1").value.substring(document.getElementById("text1").selectionEnd,document.getElementById("text1").value.length)
  }
  else 
  {
    var selectedText = document.getElementById("text1").createRange().text;
    if (selectedText != "") 
    {
        var newText = "<" + tag + ">" + selectedText + "</" + tag + ">";
        document.getElementById("text1").createRange().text = newText;
    }
  }
}

function l_align()
{
 document.getElementById("left").innerHTML="<img src='pix/l_align_s.jpg' alt='left align selected' style='cursor: pointer;' onclick='l_align()'/>";
 document.getElementById("center").innerHTML="<img src='pix/c_align.jpg' alt='center align' style='cursor: pointer;' onclick='c_align()'/>";
 document.getElementById("right").innerHTML="<img src='pix/r_align.jpg' alt='right align' style='cursor: pointer;' onclick='r_align()'/>";
 document.getElementById("text1").style.textAlign='left';
}
function c_align()
{
 document.getElementById("left").innerHTML="<img src='pix/l_align.jpg' alt='left align' style='cursor: pointer;' onclick='l_align()'/>";
 document.getElementById("center").innerHTML="<img src='pix/c_align_s.jpg' alt='center align selected' style='cursor: pointer;' onclick='c_align()'/>";
 document.getElementById("right").innerHTML="<img src='pix/r_align.jpg' alt='right align' style='cursor: pointer;' onclick='r_align()'/>";
 document.getElementById("text1").style.textAlign='center';
}
function r_align()
{
 document.getElementById("left").innerHTML="<img src='pix/l_align.jpg' alt='left align' style='cursor: pointer;' onclick='l_align()'/>";
 document.getElementById("center").innerHTML="<img src='pix/c_align.jpg' alt='center align' style='cursor: pointer;' onclick='c_align()'/>";
 document.getElementById("right").innerHTML="<img src='pix/r_align_s.jpg' alt='right align selected' style='cursor: pointer;' onclick='r_align()'/>";
 document.getElementById("text1").style.textAlign='right';
}
function insert_symbol()
{
 window.open('symbol.php','symbol','width=450,height=450')
}
function fade_on(cell)
{
  cell.style.border="1px black solid;";
}

function fade_out(cell)
{
  cell.style.border="0px white solid;";
}
</script>
</head>

<body onLoad='change_font()<?php if (!$id) echo ", l_align()";?>'>
<link media="screen" type="text/css" rel="stylesheet"  href="../main.css" />
<div align='center'>
<img src='pix/webtext2.png' alt=''/><br/>
c/o R<small>OTIDE</small> E<small>GAP</small>
</div>
<br/>
<div style='font-size: 10pt;'>
Fill in the below form with the information you want, then click <b>Add Text</b>.
</div>
<br/>
<form method='post' action='javascript:create_text()'>
<table summary='pic_table' border='0' width='95%' height='200' style='border: 2px black solid;' cellspacing='2px'>
  <tr>
    <td>
    <table summary='options' border='0'>
      <tr>
        <td align='left'>
            <select id='font' name='font' onchange='change_font()' valign='top' <?php if ($id) echo "disabled='true'";?>>
          <?php
          $font = array('Arial',
                        'Bradley Hand ITC',
                        'Comic Sans MS',
                        'Fixedsys',
                        'Impact',
                        'Lucida Console',
                        'Tahoma',
                        'Times New Roman');
          $x=0;
          while($x <= count($font)-1)
          {
            echo "\t<option id='$font[$x]'>".ucfirst($font[$x])."</option>\n";
            $x++; 
          }
          ?>
        </select>
      </td>
      <td align='left'>
        <select id='font_size' name='font_size' valign='top' <?php if ($id) echo "disabled='true'";?>>
          <?php
          $font_size = array('8',
                             '10',
                             '12',
                             '14',
                             '16',
                             '20',
                             '24',
                             '36',
                             '48',
                             '72');
          $x=0;
          while($x <= count($font_size)-1)
          {
            echo "\t<option id='$font_size[$x]'";
            if ($font_size[$x] == "12")
							echo " selected='true'";
            echo ">".$font_size[$x]."</option>\n";
            $x++; 
          }
          ?>
        </select>
      </td>
      <td align='left'>
        <img src='pix/font_color<?php if ($id) echo "_d";?>.jpg' alt='Font Color' <?php if (!$id) echo "style='cursor: pointer;' onclick='font_color()'"?>/>
      </td>
      <td>
        <img src='pix/paint<?php if ($id) echo "_d";?>.jpg' alt='Fill Color' <?php if (!$id) echo "style='cursor: pointer;' onclick='bg_color()'"?>/>
      </td>
      <td class='spacer'>|</td>
      <td id='bold'>
        <img src='pix/bold.jpg' alt='bold' style='cursor: pointer;' onclick="formatText('b')"/>
      </td>
      <td id='itl'>
        <img src='pix/italic.jpg' alt='italic' style='cursor: pointer;' onclick="formatText('i')"/>
      </td>
      <td id='line'>
        <img src='pix/underline.jpg' alt='underline' style='cursor: pointer;' onclick="formatText('u')"/>
      </td>
      <td class='spacer'>|</td>
      <td id='left'>
        <img src='pix/l_align<?php if ($id) echo "_d";?>.jpg' alt='left align' <?php if (!$id) echo "style='cursor: pointer;' onclick='l_align()'"?>/>
      </td>
      <td id='center'>
        <img src='pix/c_align<?php if ($id) echo "_d";?>.jpg' alt='center align' <?php if (!$id) echo "style='cursor: pointer;' onclick='c_align()'"?>/>
      </td>
      <td id='right'>
        <img src='pix/r_align<?php if ($id) echo "_d";?>.jpg' alt='right align' <?php if (!$id) echo "style='cursor: pointer;' onclick='r_align()'"?>/>
      </td>
      <td>
        <img src='pix/symbol.jpg' alt='symbol' style='cursor: pointer;' onclick='insert_symbol()'/>
      </td>
    </tr>
</table>
    </td>
  </tr> 
  <tr>
    <td>
      <?php extract ($_GET); if ($id) echo "<script type='text/javascript'>document.write(\"<textarea id='text1' name='text1' cols='70' rows='7'>\"+window.opener.document.getElementById(\"$id\").innerHTML+\"</textarea>\")</script>"; else echo "<textarea id='text1' name='text1' cols='70' rows='7'></textarea>";?>
    </td>
  </tr>
</table>
  <div align='center'>
    <input type='submit' value='Add Text' style='font-weight: bold'/>&nbsp;&nbsp;&nbsp;<button value='Cancel' onclick='window.close()'>Cancel Text</button>
  </div>
</body>
</html>
Return current item: NetLink