Location: PHPKode > projects > GUP: GTP Usability Prototype > templates/input/EditS.tpl
loosy static

%#SO_SCRIPT#%

  amountOfActions = %^AMOUNTOFACTIONS^%;
  rowTypes = new Array(20);
  %^FILLROWTYPES^%  

 function show(name){
    document.getElementById(name).style.visibility = 'inherit';
    document.getElementById(name).style.display = 'inline';
 }

 function hide(name){    
    document.getElementById(name).style.visibility = 'hidden';
    document.getElementById(name).style.display = 'none';   
 }

 function addAction(){
	action = document.getElementById("actionname").value;
	show(action+"_"+amountOfActions);
	rowTypes[amountOfActions] = action;
	document.getElementById("t_"+amountOfActions).value = action;
	amountOfActions++;	
	document.getElementById("amountOfActions").value = amountOfActions;
 }

 function Switch(row){
   	if ((row == 0) || (row > (amountOfActions-1))){
	  return;
	}
	rowMinOne = row -1;
	param1 = document.getElementById(rowTypes[row-1]+"p_"+rowMinOne+"_1").value;
	param2 = document.getElementById(rowTypes[row-1]+"p_"+rowMinOne+"_2").value;

	//clear values 
	document.getElementById(rowTypes[row-1]+"p_"+rowMinOne+"_1").value ="";
	document.getElementById(rowTypes[row-1]+"p_"+rowMinOne+"_2").value ="";

	// set values in upperRow
	document.getElementById(rowTypes[row]+"p_"+rowMinOne+"_1").value = document.getElementById(rowTypes[row]+"p_"+row+"_1").value;
	document.getElementById(rowTypes[row]+"p_"+rowMinOne+"_2").value = document.getElementById(rowTypes[row]+"p_"+row+"_2").value;
	
	// set values in row
	document.getElementById(rowTypes[row-1]+"p_"+row+"_1").value = param1;
	document.getElementById(rowTypes[row-1]+"p_"+row+"_2").value = param2;

	//now set the rowTypes:
	upperRow = rowTypes[row-1];
	rowTypes[row-1] = rowTypes[row];
	rowTypes[row] = upperRow;

	document.getElementById("t_"+rowMinOne).value = rowTypes[row-1];
	document.getElementById("t_"+row).value = upperRow;

	//and visually switch:
	hide(rowTypes[row-1]+"_"+row);
	hide(rowTypes[row]+"_"+rowMinOne);
	show(rowTypes[row]+"_"+row);
	show(rowTypes[rowMinOne]+"_"+rowMinOne);
   
 }

 function remove(row){
	for (teller = row+1 ;teller < amountOfActions;teller++){
	  Switch(teller);
	}
	rowMinOne = amountOfActions -1;
	document.getElementById(rowTypes[amountOfActions-1]+"p_"+rowMinOne+"_1").value = "";
	document.getElementById(rowTypes[amountOfActions-1]+"p_"+rowMinOne+"_2").value = "";
	hide(rowTypes[rowMinOne]+"_"+rowMinOne);
	amountOfActions --;
	document.getElementById("amountOfActions").value = amountOfActions;
 }

 

%#EO_SCRIPT#%

%#SO_CONTENT#%
<FONT CLASS="head_caption">Splitter: </FONT><FONT CLASS="head_names">%^NAME^%</FONT>
<HR>

Add split action : <SELECT id="actionname">
		<OPTION value="f">Fixed length</OPTION>
		<OPTION value="e">Empty lines</OPTION>
		<OPTION value="s">String split</OPTION>
		<OPTION value="c">Combine sections</OPTION>
		</SELECT>
		<BUTTON onclick="addAction();">Add</BUTTON>
<BR>
%^ERRORS^%
<BR>
<FORM METHOD="POST" ACTION="%^POST_ACTION^%">
%^SPLITROWS^%
<BR><BR>

<INPUT TYPE="submit" name="submitbutton" value="Save Settings"> &nbsp;
<BUTTON onclick="clear();">Clear</BUTTON>
</FORM>
<HR>
<a href="index.php?action=editInput&testSet=%^TESTSETID^%">Back to Input settings</a>
<HR>
Help:<BR>
<pre>
There are 4 split-actions you can perform on documents.

The first one is fixed length splitting. It splits each part into equally sized parts.

the second is the empty line splitter. It splits on lines that contain no visible characters. (a space,tab or return character is not visible)
Determine on how many empty lines there has to be split with the count operator. 
Remarks: if a section exists of more then one empty line behind each other, it will be counted as one empty line.

th third split action is the separatorstring action. With this action you can do various split constructions.
You can enter a string one what to split, but you can also include the following special characters:

\n : Newline unix and windows format
\r : Newline windows format. (A Windows return format exist of the sequence \r\n)
\t : Tab

With this splitter you can also for example split on a fixed amount of words. set a space as string as character.<BR>

The fourth action is the low character combination combiner. This Splitter combines small split sections with their neighbors.<BR>\
You can choose the preferred neighbour above or below.

Example: combine parts with less then 100 characters to the part below:

Section n = 
"The maximum length of a bridge
"

Section n+1 = 
"This depends on the design of the structure. If you choose to design a suspensionbridge in a rocky area with high winds, it is preferrable to ...."

Section n will be combined with section n+1.

<HR>
The split actions are executed sequentially. so the following splitter setting :

1 split on 1000 characters.
2 split on 10 empty lines.
3 Combine parts with less then 100 characters to the part below.
3 split on string "ape".
4 split on string "\n"

executes as follows:

files are split in section of 1000 characters.

sections of 1000 characters are split on every 10th empty line (starting from the first character of the section).

Combine blah blah blah ... har har har ... zz. zzz. zzzz. 
</pre>

<BR><BR>
%#EO_CONTENT#%
Return current item: GUP: GTP Usability Prototype