<?
// history_edit_wml.php
//
// Copyright, Exolution GmbH / Michael Kerrisk, Sep 2000
// http://www.exolution.com/wapsh   mailto:wapsh@exolution.de
//
// This software is Open Source licensed under the terms of the Trolltech QPL
// version 1.0.  See http://www.exolution.de/wapsh for further information.
//
// -------------------------------------------------------------------
//
// WML History editing page - allow one command to be edited and resubmitted
//
    require("common.inc");
    require("common_wml.inc");
    header("Content-type: text/vnd.wap.wml");
    require("displayfuncs.inc");

    echo '<?xml version="1.0" encoding="iso-8859-1"?>';
?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

<card title="<? echo SYSTEM_NAME; ?> history" newcontext="true">

<?
    if (($setOptions & OPT_HISTORY) == 0) {
	echo $sParaBlk(sEmphBlk("Those who do not remember history " .
		    "cannot repeat it"));
	echo $sParaBlk("(History is not enabled for this session)");
    } else if ($cmdNum <= 0) {
	echo sParaBlk("The command history is empty");
    } else if (!isset($cmdIdx) || $cmdIdx <= 0 || $cmdIdx > $cmdNum) {
	echo sParaBlk("No such command");
    } else {
	//
	    echo '<p>';
	    echo "COMMAND $cmdIdx: ";

            echo '<input type="text" name="fSh" format="*M" size="20" value="' .
			escBrowserSpecialChars($histCmd[$cmdIdx]) .
			'" maxlength="100"/>';

            echo 'Newline? ';
            echo wmlYesNoSelect("fNl", (isset($histAddNl[$cmdIdx]) && 
			$histAddNl[$cmdIdx] == "y") ? "y" : "n", "Newline?");
					
            if ($setOptions & OPT_ALLOWSILENT) {
                echo '&gt; null? ';
                echo wmlYesNoSelect("fSil", (isset($histSilent[$cmdIdx]) && 
			$histSilent[$cmdIdx] == "y") ?  "y" : "n", 
			"Null output?");
            }
	    
            //echo '<br/>';
	    wmlSubmitAnchor("Send input", "command.php", "post", 
		    $shCommFields . 
	    	        '<postfield name="sendCmd" value="y"/>' .
	    	        '<postfield name="cmdForm" value="y"/>' .
	    	        '<postfield name="shCmd" value="$(fSh)"/>' .
	    	        '<postfield name="addNl" value="$(fNl)"/>' .
	    	        '<postfield name="silent" value="$(addNl)"/>');
            echo '</p>';
	    wmlSoftkeyItem("goHist", "Back to history", "history_wml.php", 
		"post", 
		$commFields . 
	    	    '<postfield name="cmdStart" value="' . $cmdStart . '"/>');

    } // if
    wmlSoftkeyHomeLink();

?>

</card>
</wml>
